Skip to content

Commit

Permalink
Refactor Cargo.toml Significantly (#6980)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored Jan 23, 2025
1 parent 04aff59 commit d8e7ab1
Show file tree
Hide file tree
Showing 49 changed files with 425 additions and 483 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings
WASM_BINDGEN_TEST_TIMEOUT: 300 # 5 minutes
CACHE_SUFFIX: c # cache busting
CACHE_SUFFIX: d # cache busting
WGPU_TESTING: true

# We distinguish the following kinds of builds:
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 17 additions & 46 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,21 @@ repository = "https://github.com/gfx-rs/wgpu"
version = "24.0.0"
authors = ["gfx-rs developers"]

[workspace.dependencies.wgc]
package = "wgpu-core"
path = "./wgpu-core"
version = "24.0.0"

[workspace.dependencies.wgt]
package = "wgpu-types"
path = "./wgpu-types"
version = "24.0.0"

[workspace.dependencies.hal]
package = "wgpu-hal"
path = "./wgpu-hal"
version = "24.0.0"

[workspace.dependencies.naga]
path = "./naga"
version = "24.0.0"

[workspace.dependencies]
naga = { version = "24.0.0", path = "./naga" }
wgpu = { version = "24.0.0", path = "./wgpu", default-features = false, features = [
"serde",
"wgsl",
"dx12",
"metal",
"static-dxc",
] }
wgpu-core = { version = "24.0.0", path = "./wgpu-core" }
wgpu-hal = { version = "24.0.0", path = "./wgpu-hal" }
wgpu-macros = { version = "24.0.0", path = "./wgpu-macros" }
wgpu-test = { version = "24.0.0", path = "./tests" }
wgpu-types = { version = "24.0.0", path = "./wgpu-types" }

anyhow = "1.0.95"
argh = "0.1.13"
arrayvec = "0.7"
Expand Down Expand Up @@ -141,17 +136,6 @@ strum = { version = "0.26.0", features = ["derive"] }
trybuild = "1"
tracy-client = "0.17"
thiserror = "2"
wgpu = { version = "24.0.0", path = "./wgpu", default-features = false, features = [
"serde",
"wgsl",
"dx12",
"metal",
"static-dxc",
] }
wgpu-core = { version = "24.0.0", path = "./wgpu-core" }
wgpu-macros = { version = "24.0.0", path = "./wgpu-macros" }
wgpu-test = { version = "24.0.0", path = "./tests" }
wgpu-types = { version = "24.0.0", path = "./wgpu-types" }
winit = { version = "0.29", features = ["android-native-activity"] }

# Metal dependencies
Expand All @@ -166,7 +150,7 @@ ash = "0.38.0"
gpu-alloc = "0.6"
gpu-descriptor = "0.3"

# DX dependencies
# DX12 dependencies
bit-set = "0.8"
gpu-allocator = { version = "0.27", default-features = false }
range-alloc = "0.1"
Expand All @@ -180,7 +164,7 @@ glutin = { version = "0.31", default-features = false }
glutin-winit = { version = "0.4", default-features = false }
glutin_wgl_sys = "0.6"

# DX and GLES dependencies
# DX12 and GLES dependencies
windows = { version = "0.58", default-features = false }

# wasm32 dependencies
Expand All @@ -206,21 +190,8 @@ termcolor = "1.4.1"
# android dependencies
ndk-sys = "0.5.0"

[patch."https://github.com/gfx-rs/naga"]

[patch."https://github.com/zakarumych/gpu-descriptor"]
#gpu-descriptor = { path = "../gpu-descriptor/gpu-descriptor" }

[patch."https://github.com/zakarumych/gpu-alloc"]
#gpu-alloc = { path = "../gpu-alloc/gpu-alloc" }

[patch.crates-io]
#glow = { path = "../glow" }
#web-sys = { path = "../wasm-bindgen/crates/web-sys" }
#js-sys = { path = "../wasm-bindgen/crates/js-sys" }
#wasm-bindgen = { path = "../wasm-bindgen" }

# These overrides allow our examples to explicitly depend on release crates
[patch.crates-io]
wgpu = { path = "./wgpu" }

[profile.release]
Expand Down
47 changes: 24 additions & 23 deletions deno_webgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,37 @@ path = "lib.rs"
# We make all dependencies conditional on not being wasm,
# so the whole workspace can built as wasm.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
deno_core.workspace = true
serde = { workspace = true, features = ["derive"] }
tokio = { workspace = true, features = ["full"] }
wgt = { workspace = true, package = "wgpu-types", features = ["serde"] }
raw-window-handle = { workspace = true }
thiserror.workspace = true

[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgpu-core]
workspace = true
features = [
wgpu-core = { workspace = true, features = [
"raw-window-handle",
"trace",
"replay",
"serde",
"strict_asserts",
"wgsl",
"gles",
]
] }
wgpu-types = { workspace = true, features = ["serde"] }

deno_core.workspace = true
raw-window-handle = { workspace = true }
serde = { workspace = true, features = ["derive"] }
thiserror.workspace = true
tokio = { workspace = true, features = ["full"] }

# We want the wgpu-core Metal backend on macOS and iOS.
[target.'cfg(target_vendor = "apple")'.dependencies.wgpu-core]
workspace = true
features = ["metal"]
# Apple Platforms
#
# We want the Metal backend.
[target.'cfg(target_vendor = "apple")'.dependencies]
wgpu-core = { workspace = true, features = ["metal"] }

# We want the wgpu-core Direct3D backend on Windows.
[target.'cfg(windows)'.dependencies.wgpu-core]
workspace = true
features = ["dx12"]
# Windows
#
# We want the DX12 backend.
[target.'cfg(windows)'.dependencies]
wgpu-core = { workspace = true, features = ["dx12"] }

# We want the wgpu-core Vulkan backend on Unix (but not Emscripten) and Windows.
[target.'cfg(any(windows, all(unix, not(target_os = "emscripten"))))'.dependencies.wgpu-core]
workspace = true
features = ["vulkan"]
# Windows and Unix (not Emscripten)
#
# We want the Vulkan backend.
[target.'cfg(any(windows, all(unix, not(target_os = "emscripten"))))'.dependencies]
wgpu-core = { workspace = true, features = ["vulkan"] }
1 change: 0 additions & 1 deletion deno_webgpu/binding.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::error::WebGpuResult;
use super::wgpu_types;
use deno_core::error::AnyError;
use deno_core::op2;
use deno_core::OpState;
Expand Down
1 change: 0 additions & 1 deletion deno_webgpu/buffer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::error::WebGpuResult;
use super::wgpu_types;
use deno_core::futures::channel::oneshot;
use deno_core::op2;
use deno_core::OpState;
Expand Down
1 change: 0 additions & 1 deletion deno_webgpu/bundle.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::wgpu_types;
use deno_core::op2;
use deno_core::OpState;
use deno_core::Resource;
Expand Down
1 change: 0 additions & 1 deletion deno_webgpu/command_encoder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::wgpu_types;
use crate::WebGpuQuerySet;
use deno_core::error::AnyError;
use deno_core::op2;
Expand Down
2 changes: 0 additions & 2 deletions deno_webgpu/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use std::borrow::Cow;
use std::cell::RefCell;
use std::collections::HashSet;
use std::rc::Rc;
pub use wgpu_core;
pub use wgt as wgpu_types;

use error::WebGpuResult;

Expand Down
1 change: 0 additions & 1 deletion deno_webgpu/pipeline.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::wgpu_types;
use deno_core::error::AnyError;
use deno_core::op2;
use deno_core::OpState;
Expand Down
1 change: 0 additions & 1 deletion deno_webgpu/queue.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::wgpu_types;
use crate::command_encoder::WebGpuCommandBuffer;
use crate::Instance;
use deno_core::error::AnyError;
Expand Down
1 change: 0 additions & 1 deletion deno_webgpu/render_pass.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::wgpu_types;
use deno_core::op2;
use deno_core::OpState;
use deno_core::Resource;
Expand Down
1 change: 0 additions & 1 deletion deno_webgpu/sampler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::wgpu_types;
use deno_core::op2;
use deno_core::OpState;
use deno_core::Resource;
Expand Down
1 change: 0 additions & 1 deletion deno_webgpu/shader.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::wgpu_types;
use deno_core::op2;
use deno_core::OpState;
use deno_core::Resource;
Expand Down
1 change: 0 additions & 1 deletion deno_webgpu/surface.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::wgpu_types;
use super::WebGpuResult;
use deno_core::op2;
use deno_core::OpState;
Expand Down
1 change: 0 additions & 1 deletion deno_webgpu/texture.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

use super::wgpu_types;
use deno_core::op2;
use deno_core::OpState;
use deno_core::Resource;
Expand Down
21 changes: 9 additions & 12 deletions naga-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@ doc = false
test = false

[dependencies]
bincode.workspace = true
codespan-reporting.workspace = true
env_logger.workspace = true
argh.workspace = true
anyhow.workspace = true
log.workspace = true

[dependencies.naga]
version = "24.0.0"
path = "../naga"
features = [
naga = { workspace = true, features = [
"compact",
"wgsl-in",
"wgsl-out",
Expand All @@ -41,4 +31,11 @@ features = [
"dot-out",
"serialize",
"deserialize",
]
] }

bincode.workspace = true
codespan-reporting.workspace = true
env_logger.workspace = true
argh.workspace = true
anyhow.workspace = true
log.workspace = true
11 changes: 6 additions & 5 deletions player/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@ path = "src/bin/play.rs"
test = false

[dependencies]
wgpu-types = { workspace = true, features = ["serde"] }

env_logger.workspace = true
log.workspace = true
raw-window-handle.workspace = true
ron.workspace = true
winit = { workspace = true, optional = true }

[dependencies.wgt]
workspace = true
features = ["serde"]

[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc]
# Non-Webassembly
#
# We are a non-wasm only crate, and this allows us to compile.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgpu-core]
workspace = true
features = [
"replay",
Expand Down
3 changes: 3 additions & 0 deletions player/src/bin/play.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#[cfg(not(target_arch = "wasm32"))]
fn main() {
extern crate wgpu_core as wgc;
extern crate wgpu_types as wgt;

use player::GlobalPlay as _;
use wgc::device::trace;

Expand Down
3 changes: 3 additions & 0 deletions player/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#![cfg(not(target_arch = "wasm32"))]
#![warn(clippy::allow_attributes, unsafe_op_in_unsafe_fn)]

extern crate wgpu_core as wgc;
extern crate wgpu_types as wgt;

use wgc::device::trace;

use std::{borrow::Cow, fs, path::Path};
Expand Down
3 changes: 3 additions & 0 deletions player/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#![cfg(not(target_arch = "wasm32"))]

extern crate wgpu_core as wgc;
extern crate wgpu_types as wgt;

use player::GlobalPlay;
use std::{
fs::{read_to_string, File},
Expand Down
9 changes: 6 additions & 3 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ harness = true
webgl = ["wgpu/webgl"]

[dependencies]
wgpu.workspace = true
wgpu-macros.workspace = true

anyhow.workspace = true
arrayvec.workspace = true
approx.workspace = true
Expand All @@ -46,20 +49,20 @@ serde_json.workspace = true
serde.workspace = true
strum = { workspace = true, features = ["derive"] }
trybuild.workspace = true
wgpu.workspace = true
wgpu-macros.workspace = true
wgt = { workspace = true, features = ["serde"] }

# Non-Webassembly
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
env_logger.workspace = true
nv-flip.workspace = true
parking_lot = { workspace = true, features = ["deadlock_detection"] }

# Webassembly
[target.'cfg(target_arch = "wasm32")'.dependencies]
console_log.workspace = true
wasm-bindgen.workspace = true
web-sys = { workspace = true }

# Webassembly Dev Dependencies
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
image.workspace = true
js-sys.workspace = true
Expand Down
Loading

0 comments on commit d8e7ab1

Please sign in to comment.