pixels icon indicating copy to clipboard operation
pixels copied to clipboard

Add a feature flag for webgl backend

Open KaminariOS opened this issue 2 years ago • 2 comments

Currently, if I want to use wasm-pack to build for wasm32, I have to specify

[target.'cfg(target_arch = "wasm32")'.dependencies]
wgpu = { features = ["webgl"]}

The Cargo warns that warning: dependency (wgpu) specified without providing a local path, Git repository, or version to use. This will be considered an error in future versions

To solve this problem, we should add

[features]
web = ["wgpu/webgl"]

to the Cargo.toml of this crate.

KaminariOS avatar Jun 02 '22 04:06 KaminariOS

You can add a dependency on wgpu in your crate, even if it is otherwise unreferenced. I'm not opposed to adding features, though.

parasyte avatar Jun 03 '22 05:06 parasyte

A simple and safe way to do this is to add one line here:

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
pollster = "0.2"
wgpu = { version = "0.12", features = ["webgl"]}

KaminariOS avatar Jun 08 '22 08:06 KaminariOS

This was fixed by #320

parasyte avatar Dec 18 '22 02:12 parasyte