diff --git a/.cargo/config.toml b/.cargo/config.toml index a590c044d81..635229119f8 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -3,3 +3,6 @@ rustflags = "-C link-arg=/STACK:8000000" [target.'cfg(all(target_os = "windows", not(target_env = "msvc")))'] rustflags = "-C link-args=-Wl,--stack,8000000" + +[target.wasm32-unknown-unknown] +rustflags = ["--cfg=getrandom_backend=\"wasm_js\""] diff --git a/common/Cargo.toml b/common/Cargo.toml index 94704d18c99..79bf058ebe2 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -10,6 +10,7 @@ license.workspace = true [features] threading = ["parking_lot"] +wasm_js = ["getrandom/wasm_js"] [dependencies] rustpython-literal = { workspace = true } diff --git a/vm/Cargo.toml b/vm/Cargo.toml index 803eae014e7..938cb0bb413 100644 --- a/vm/Cargo.toml +++ b/vm/Cargo.toml @@ -24,7 +24,7 @@ ast = ["ruff_python_ast", "ruff_text_size"] codegen = ["rustpython-codegen", "ast"] parser = ["ast"] serde = ["dep:serde"] -wasmbind = ["chrono/wasmbind", "getrandom/wasm_js", "wasm-bindgen"] +wasmbind = ["rustpython-common/wasm_js", "chrono/wasmbind", "wasm-bindgen"] [dependencies] rustpython-compiler = { workspace = true, optional = true } diff --git a/wasm/lib/.cargo/config.toml b/wasm/lib/.cargo/config.toml index ce1e7c694ae..f4e8c002fc2 100644 --- a/wasm/lib/.cargo/config.toml +++ b/wasm/lib/.cargo/config.toml @@ -1,5 +1,2 @@ [build] target = "wasm32-unknown-unknown" - -[target.wasm32-unknown-unknown] -rustflags = ["--cfg=getrandom_backend=\"wasm_js\""]