# Copyright © SixtyFPS GmbH <info@slint.dev>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

[package]
name = "i-slint-renderer-skia"
description = "Skia based renderer for Slint"
authors.workspace = true
edition = "2024"
homepage.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
version.workspace = true
build = "build.rs"

[lib]
path = "lib.rs"

# Note, these features need to be kept in sync (along with their defaults) in
# the C++ crate's CMakeLists.txt
[features]
wayland = ["glutin/wayland", "softbuffer/wayland", "softbuffer/wayland-dlopen"]
x11 = ["glutin/x11", "glutin/glx", "softbuffer/x11", "softbuffer/x11-dlopen"]
opengl = []
vulkan = ["skia-safe/vulkan", "dep:ash", "vulkano"]
kms = ["softbuffer/kms"]
# wgpu-{27,28} enables the wgpu surface module for internal use (e.g. linuxkms DRM rendering).
# unstable-wgpu-* additionally exposes public API integration (GraphicsAPI, texture import).
wgpu-27 = [
  "i-slint-core/wgpu-27",
  "dep:wgpu-27",
  "dep:spin_on",
  "dep:metal",
  "dep:foreign-types",
  "dep:ash",
  "dep:windows_58",
  "dep:windows-core",
  "dep:windows-core_58",
]
unstable-wgpu-27 = ["i-slint-core/unstable-wgpu-27", "wgpu-27"]
wgpu-28 = [
  "i-slint-core/wgpu-28",
  "dep:wgpu-28",
  "dep:spin_on",
  "dep:metal",
  "dep:foreign-types",
  "dep:ash",
  "dep:windows-core",
]
unstable-wgpu-28 = ["i-slint-core/unstable-wgpu-28", "wgpu-28"]
default = ["softbuffer"]

[dependencies]
i-slint-core = { workspace = true, features = ["default", "box-shadow-cache", "shared-parley"] }
i-slint-core-macros = { workspace = true, features = ["default"] }
i-slint-common = { workspace = true, features = ["default"] }

const-field-offset = { version = "0.2", path = "../../../helper_crates/const-field-offset" }
vtable = { workspace = true }

cfg-if = "1"
derive_more = { workspace = true }
lyon_path = { workspace = true }
pin-weak = "1"
scoped-tls-hkt = "0.1"
raw-window-handle = { version = "0.6", features = ["std"] }
clru = { workspace = true }

skia-safe = { version = "0.90", features = ["gl"] }
glow = { workspace = true }
unicode-segmentation = { workspace = true }

ash = { version = "^0.38.0", optional = true }
vulkano = { version = "0.35.0", optional = true, default-features = false }

wgpu-27 = { workspace = true, optional = true }
wgpu-28 = { workspace = true, optional = true }
spin_on = { version = "0.1", optional = true }

[target.'cfg(any(not(target_vendor = "apple"), target_os = "macos"))'.dependencies]
glutin = { workspace = true, default-features = false, features = ["egl", "wgl"] }

[target.'cfg(not(target_os = "android"))'.dependencies]
# software renderer fallback
softbuffer = { workspace = true, default-features = false, optional = true }
bytemuck = { workspace = true }

[target.'cfg(target_family = "windows")'.dependencies]
windows = { workspace = true, features = ["Win32", "Win32_System_Com", "Win32_Graphics", "Win32_Graphics_Dxgi", "Win32_Graphics_Direct3D12", "Win32_Graphics_Direct3D", "Win32_Foundation", "Win32_Graphics_Dxgi_Common", "Win32_System_Threading", "Win32_Security"] }
# Separate builds of the windows crate are needed until https://github.com/gfx-rs/wgpu/pull/6876 is
# merged and released.
windows_58 = { package = "windows", version = "0.58.0", optional = true, features = ["Win32", "Win32_System_Com", "Win32_Graphics", "Win32_Graphics_Dxgi", "Win32_Graphics_Direct3D12", "Win32_Graphics_Direct3D", "Win32_Foundation", "Win32_Graphics_Dxgi_Common", "Win32_System_Threading", "Win32_Security"] }
windows-core = { workspace = true, optional = true }
windows-core_58 = { package = "windows-core", version = "0.58.0", optional = true }
skia-safe = { version = "0.90", features = ["d3d"] }
wgpu-27 = { workspace = true, optional = true, features = ["dx12"] }
wgpu-28 = { workspace = true, optional = true, features = ["dx12"] }

[target.'cfg(target_vendor = "apple")'.dependencies]
objc2 = { version = "0.6.0" }
objc2-metal = { version = "0.3.2", default-features = false, features = ["std", "MTLCommandQueue", "MTLCommandBuffer", "MTLResource", "MTLTexture", "MTLTypes"] }
objc2-foundation = { version = "0.3.2", default-features = false, features = ["std", "NSGeometry"] }
objc2-quartz-core = { version = "0.3.2", default-features = false, features = ["std", "objc2-metal", "CALayer", "CAMetalLayer", "objc2-core-foundation"] }
objc2-app-kit = { version = "0.3.2", default-features = false, features = ["std", "NSResponder", "NSView"] }
objc2-core-foundation = { version = "0.3.2", default-features = false, features = ["CFCGTypes"] }
skia-safe = { version = "0.90", features = ["metal"] }
raw-window-metal = "1.0"

metal = { version = "0.31", optional = true }
foreign-types = { version = "0.5.0", optional = true }
wgpu-27 = { workspace = true, optional = true, features = ["metal"] }
wgpu-28 = { workspace = true, optional = true, features = ["metal"] }

read-fonts = { workspace = true }
# Pinned to 0.45 to align with read-fonts from parley and avoid duplicated dependencies
write-fonts = { version = "0.45" }

[target.'cfg(not(any(target_vendor = "apple", target_family = "windows")))'.dependencies]
skia-safe = { version = "0.90", features = ["gl", "vulkan"] }
wgpu-27 = { workspace = true, optional = true, features = ["vulkan"] }
wgpu-28 = { workspace = true, optional = true, features = ["vulkan"] }

[target.'cfg(any(target_os = "ios", target_os="macos", target_os="windows", target_os="android", target_os="linux"))'.dependencies]
# Text layout is enabled here just so that we can make use of the pre-built Skia libraries.
skia-safe = { version = "0.90", features = ["textlayout"] }

[target.aarch64-apple-ios-sim.dependencies]
# Disabling encoding assertions until https://github.com/madsmtm/objc2/issues/795 is fixed.
objc2 = { version = "0.6.0", features = ["disable-encoding-assertions"] }

[build-dependencies]
cfg_aliases = { workspace = true }

[package.metadata.docs.rs]
rustdoc-args = ["--generate-link-to-definition"]
