Skip to content

Commit 09ce722

Browse files
committed
Add support for wasm32-unknown-emscripten via Pyodide
1 parent 97fe8e9 commit 09ce722

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22

33
## Unreleased
4+
### Added
5+
- Add support for extension modules built for wasm32-unknown-emscripten with Pyodide.
6+
47
### Changed
58
- Locate cdylib artifacts by handling messages from cargo instead of searching target dir (fixes build on MSYS2). [#267](https://github.com/PyO3/setuptools-rust/pull/267)
69
- Fix RustBin build without wheel. [#273](https://github.com/PyO3/setuptools-rust/pull/273)

setuptools_rust/build.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import glob
44
import json
55
import os
6-
import pkg_resources
76
import platform
87
import shutil
98
import subprocess
@@ -20,6 +19,7 @@
2019
from pathlib import Path
2120
from typing import Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, cast
2221

22+
import pkg_resources
2323
from setuptools.command.build import build as CommandBuild # type: ignore[import]
2424
from setuptools.command.build_ext import build_ext as CommandBuildExt
2525
from setuptools.command.build_ext import get_abi3_suffix
@@ -200,6 +200,12 @@ def build_extension(
200200
# the cdylib, see https://github.com/rust-lang/cargo/issues/10143
201201
rustflags.append("-Ctarget-feature=-crt-static")
202202

203+
elif (rustc_cfgs.get("target_arch"), rustc_cfgs.get("target_os")) == (
204+
"wasm32",
205+
"emscripten",
206+
):
207+
rustc_args.extend(["-C", f"link-args=-sSIDE_MODULE=2 -sWASM_BIGINT"])
208+
203209
command = [
204210
self.cargo,
205211
"rustc",

0 commit comments

Comments
 (0)