From f6005a16c8a2e02bd6e42af254de3099009e5334 Mon Sep 17 00:00:00 2001 From: Andie Bradley Date: Sat, 20 Sep 2025 21:46:46 -0500 Subject: [PATCH] Include FreeBSD in conditional compile attributes (#8246) --- .github/workflows/ci.yml | 7 +++++++ wgpu-core/Cargo.toml | 2 +- wgpu-core/build.rs | 2 +- wgpu-core/platform-deps/windows-linux-android/Cargo.toml | 2 +- wgpu/build.rs | 4 ++-- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92e445dee..cccc07115 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,6 +127,13 @@ jobs: tier: 1 kind: native + # FreeBSD + - name: FreeBSD x86_64 + os: ubuntu-24.04 + target: x86_64-unknown-freebsd + tier: 2 + kind: wgpu-only + # Android - name: Android aarch64 os: ubuntu-24.04 diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index d4772efa2..170d0f749 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -161,7 +161,7 @@ wgpu-core-deps-apple = { workspace = true, optional = true } wgpu-core-deps-emscripten = { workspace = true, optional = true } [target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies] wgpu-core-deps-wasm = { workspace = true, optional = true } -[target.'cfg(any(windows, target_os = "linux", target_os = "android"))'.dependencies] +[target.'cfg(any(windows, target_os = "linux", target_os = "android", target_os = "freebsd"))'.dependencies] wgpu-core-deps-windows-linux-android = { workspace = true, optional = true } [dependencies] diff --git a/wgpu-core/build.rs b/wgpu-core/build.rs index a01f5afe3..159824140 100644 --- a/wgpu-core/build.rs +++ b/wgpu-core/build.rs @@ -1,6 +1,6 @@ fn main() { cfg_aliases::cfg_aliases! { - windows_linux_android: { any(windows, target_os = "linux", target_os = "android") }, + windows_linux_android: { any(windows, target_os = "linux", target_os = "android", target_os = "freebsd") }, send_sync: { all( feature = "std", any( diff --git a/wgpu-core/platform-deps/windows-linux-android/Cargo.toml b/wgpu-core/platform-deps/windows-linux-android/Cargo.toml index 7de228cdf..c014b8feb 100644 --- a/wgpu-core/platform-deps/windows-linux-android/Cargo.toml +++ b/wgpu-core/platform-deps/windows-linux-android/Cargo.toml @@ -23,5 +23,5 @@ dx12 = ["wgpu-hal/dx12"] renderdoc = ["wgpu-hal/renderdoc"] # Depend on wgpu-hal conditionally, so that the above features only apply to wgpu-hal on this set of platforms. -[target.'cfg(any(windows, target_os = "linux", target_os = "android"))'.dependencies] +[target.'cfg(any(windows, target_os = "linux", target_os = "android", target_os = "freebsd"))'.dependencies] wgpu-hal.workspace = true diff --git a/wgpu/build.rs b/wgpu/build.rs index 70543ba3e..9a039c265 100644 --- a/wgpu/build.rs +++ b/wgpu/build.rs @@ -16,7 +16,7 @@ fn main() { metal: { all(target_vendor = "apple", feature = "metal") }, vulkan: { any( // The `vulkan` feature enables the Vulkan backend only on "native Vulkan" platforms, i.e. Windows/Linux/Android - all(any(windows, target_os = "linux", target_os = "android"), feature = "vulkan"), + all(any(windows, target_os = "linux", target_os = "android", target_os = "freebsd"), feature = "vulkan"), // On Apple platforms, however, we require the `vulkan-portability` feature // to explicitly opt-in to Vulkan since it's meant to be used with MoltenVK. all(target_vendor = "apple", feature = "vulkan-portability") @@ -24,7 +24,7 @@ fn main() { gles: { any( // The `gles` feature enables the OpenGL/GLES backend only on "native OpenGL" platforms, i.e. Windows, Linux, Android, and Emscripten. // (Note that WebGL is also not included here!) - all(any(windows, target_os = "linux", target_os = "android", Emscripten), feature = "gles"), + all(any(windows, target_os = "linux", target_os = "android", target_os = "freebsd", Emscripten), feature = "gles"), // On Apple platforms, however, we require the `angle` feature to explicitly opt-in to OpenGL // since its meant to be used with ANGLE. all(target_vendor = "apple", feature = "angle")