Skip to content

Commit 3519b0a

Browse files
committed
Auto-detect wasm target
`wasm-pack build --no-default-features` The wasm feature still exists for compatibility but is a no-op.
1 parent 22df3de commit 3519b0a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Cargo.toml

+8-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ tracing = [
5757
]
5858
scenechange = []
5959
serialize = ["serde", "toml", "v_frame/serialize", "serde-big-array", "av1-grain/serialize"]
60-
wasm = ["wasm-bindgen"]
60+
61+
# Left here for compatibility reasons.
62+
# Does not do anything, the wasm target is auto-detected.
63+
wasm = []
6164

6265
# Enables debug dumping of lookahead computation results, specifically:
6366
# - i-qres.png: quarter-resolution luma planes,
@@ -106,7 +109,6 @@ console = { version = "0.15", optional = true }
106109
fern = { version = "0.6", optional = true }
107110
itertools = "0.12"
108111
simd_helpers = "0.1"
109-
wasm-bindgen = { version = "0.2.90", optional = true }
110112
nom = { version = "7.1.3", optional = true }
111113
new_debug_unreachable = "1.0.4"
112114
av1-grain = "0.2.3"
@@ -155,6 +157,10 @@ rand_chacha = "0.3"
155157
[target.'cfg(any(decode_test, decode_test_dav1d))'.dependencies]
156158
system-deps = "6"
157159

160+
# WASM
161+
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown", target_vendor = "unknown"))'.dependencies]
162+
wasm-bindgen = "0.2.90"
163+
158164
[[bin]]
159165
name = "rav1e"
160166
required-features = ["binaries"]

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ mod serialize {
135135

136136
mod wasm_bindgen {
137137
cfg_if::cfg_if! {
138-
if #[cfg(feature="wasm")] {
138+
if #[cfg(all(target_arch = "wasm32", target_os = "unknown", target_vendor = "unknown"))] {
139139
pub use wasm_bindgen::prelude::*;
140140
} else {
141141
pub use noop_proc_macro::wasm_bindgen;

0 commit comments

Comments
 (0)