From 60a14c67fb43e68b7e64bee45ab3fac3f4253e72 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 30 May 2024 00:55:33 +0200 Subject: [PATCH] Remove the `link` Cargo feature (#5752) --- CHANGELOG.md | 9 +++++++++ wgpu-core/Cargo.toml | 5 ----- wgpu-hal/Cargo.toml | 2 -- wgpu-hal/src/metal/surface.rs | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23370791cd..a73b79330b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,15 @@ By @stefnotch in [#5410](https://github.com/gfx-rs/wgpu/pull/5410) - Avoid introducing spurious features for optional dependencies. By @bjorn3 in [#5691](https://github.com/gfx-rs/wgpu/pull/5691) +#### Metal +- Removed the `link` Cargo feature. + + This was used to allow weakly linking frameworks. This can be achieved with putting something like the following in your `.cargo/config.toml` instead: + ```toml + [target.'cfg(target_vendor = "apple")'] + rustflags = ["-C", "link-args=-weak_framework Metal -weak_framework QuartzCore -weak_framework CoreGraphics"] + ``` + ### Bug Fixes #### General diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index c18a5066ab..711145fed9 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -32,17 +32,12 @@ ignored = ["cfg_aliases"] [lib] [features] -default = ["link"] - ## Log all API entry points at info instead of trace level. api_log_info = [] ## Log resource lifecycle management at info instead of trace level. resource_log_info = [] -## Use static linking for libraries. Disable to manually link. Enabled by default. -link = ["hal/link"] - ## Support the Renderdoc graphics debugger: ## renderdoc = ["hal/renderdoc"] diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 96ee7ff95f..9852b61081 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -37,7 +37,6 @@ ignored = ["cfg_aliases"] [lib] [features] -default = ["link"] metal = ["naga/msl-out", "dep:block"] vulkan = [ "naga/spv-out", @@ -76,7 +75,6 @@ windows_rs = ["dep:gpu-allocator"] dxc_shader_compiler = ["dep:hassle-rs"] renderdoc = ["dep:libloading", "dep:renderdoc-sys"] fragile-send-sync-non-atomic-wasm = ["wgt/fragile-send-sync-non-atomic-wasm"] -link = ["metal/link"] # Panic when running into an out-of-memory error (for debugging purposes). # # Only affects the d3d12 and vulkan backends. diff --git a/wgpu-hal/src/metal/surface.rs b/wgpu-hal/src/metal/surface.rs index 889e319493..e1eb6d5b23 100644 --- a/wgpu-hal/src/metal/surface.rs +++ b/wgpu-hal/src/metal/surface.rs @@ -17,7 +17,7 @@ use objc::{ use parking_lot::{Mutex, RwLock}; #[cfg(target_os = "macos")] -#[cfg_attr(feature = "link", link(name = "QuartzCore", kind = "framework"))] +#[link(name = "QuartzCore", kind = "framework")] extern "C" { #[allow(non_upper_case_globals)] static kCAGravityTopLeft: *mut Object;