Skip to content

Commit

Permalink
Add support for wasm32-unknown-emscripten via Pyodide
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Aug 6, 2022
1 parent 97fe8e9 commit 41823b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog

## Unreleased
### Added
- Add support for extension modules built for wasm32-unknown-emscripten with Pyodide.

### Changed
- 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)
- Fix RustBin build without wheel. [#273](https://github.com/PyO3/setuptools-rust/pull/273)
Expand Down
8 changes: 7 additions & 1 deletion setuptools_rust/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import glob
import json
import os
import pkg_resources
import platform
import shutil
import subprocess
Expand All @@ -20,6 +19,7 @@
from pathlib import Path
from typing import Dict, Iterable, List, NamedTuple, Optional, Set, Tuple, cast

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

elif (rustc_cfgs.get("target_arch"), rustc_cfgs.get("target_os")) == (
"wasm32",
"emscripten",
):
rustc_args.append(["-C", f"link-args=-sSIDE_MODULE=2 -sWASM_BIGINT"])

command = [
self.cargo,
"rustc",
Expand Down

0 comments on commit 41823b3

Please sign in to comment.