From 973cd3ebf8fae01c6c85dea244b8ce8323f6efa2 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Wed, 28 Jun 2023 12:30:28 +0200 Subject: [PATCH] feat: add link feature (#3853) --- Cargo.lock | 5 ++--- wgpu-core/Cargo.toml | 6 +++++- wgpu-hal/Cargo.toml | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f0573de9ab..aaa0ba425a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1463,10 +1463,9 @@ dependencies = [ [[package]] name = "metal" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "550b24b0cd4cf923f36bae78eca457b3a10d8a6a14a9c84cb2687b527e6a84af" +source = "git+https://github.com/gfx-rs/metal-rs.git?rev=a6a0446#a6a04463db388e8fd3e99095ab4fbb87cbe9d69c" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.3.1", "block", "core-graphics-types", "foreign-types 0.5.0", diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index a2654d2a9ff..2cfbe2d4267 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -22,7 +22,7 @@ targets = [ [lib] [features] -default = [] +default = ["link"] # Backends, passed through to wgpu-hal metal = ["hal/metal"] @@ -31,6 +31,9 @@ gles = ["hal/gles"] dx11 = ["hal/dx11"] dx12 = ["hal/dx12"] +# Use static linking for libraries. Disale to manually link. Enabled by default. +link = ["hal/link"] + # Support the Renderdoc graphics debugger: # https://renderdoc.org/ renderdoc = ["hal/renderdoc"] @@ -80,6 +83,7 @@ version = "0.16" package = "wgpu-hal" path = "../wgpu-hal" version = "0.16" +default_features = false [target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies] web-sys = { version = "0.3.60", features = ["HtmlCanvasElement", "OffscreenCanvas"] } diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 6baa39ce9a8..79eb40bffba 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -33,7 +33,7 @@ targets = [ [lib] [features] -default = [] +default = ["link"] metal = ["naga/msl-out", "block"] vulkan = ["naga/spv-out", "ash", "gpu-alloc", "gpu-descriptor", "libloading", "smallvec"] gles = ["naga/glsl-out", "glow", "khronos-egl", "libloading"] @@ -43,6 +43,7 @@ dx12 = ["naga/hlsl-out", "d3d12", "bit-set", "range-alloc", "winapi/std", "winap windows_rs = ["gpu-allocator"] dxc_shader_compiler = ["hassle-rs"] renderdoc = ["libloading", "renderdoc-sys"] +link = ["metal/link"] [[example]] name = "halmark" @@ -101,7 +102,7 @@ d3d12 = { version = "0.6.0", git = "https://github.com/gfx-rs/d3d12-rs", rev = " # backend: Metal block = { version = "0.1", optional = true } -metal = "0.25.0" +metal = { git = "https://github.com/gfx-rs/metal-rs.git", rev = "a6a0446", default_features = false } objc = "0.2.5" core-graphics-types = "0.1"