Skip to content

Commit

Permalink
Support emscripten (#100)
Browse files Browse the repository at this point in the history
* Add Emscripten support

* Add CI for emscripten target
  • Loading branch information
ChanTsune authored Sep 18, 2024
1 parent b667e6b commit e0107c0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ jobs:
- name: Test (all features)
run: CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime cargo test --target wasm32-wasi --all-features

emscripten:
name: Test Emscripten
runs-on: ubuntu-latest
container: emscripten/emsdk:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-unknown-emscripten
- name: Test (no features)
run: CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node cargo test --target wasm32-unknown-emscripten --no-default-features
- name: Test (all features)
run: CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node cargo test --target wasm32-unknown-emscripten --all-features


lints:
name: Rustfmt & Clippy
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fn check_description() {
"Incorrect function."
} else if cfg!(target_os = "illumos") {
"Not owner"
} else if cfg!(target_os = "wasi") {
} else if cfg!(target_os = "wasi") || cfg!(target_os = "emscripten") {
"Argument list too long"
} else if cfg!(target_os = "haiku") {
"Operation not allowed"
Expand Down
3 changes: 2 additions & 1 deletion src/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ extern "C" {
target_os = "linux",
target_os = "hurd",
target_os = "redox",
target_os = "dragonfly"
target_os = "dragonfly",
target_os = "emscripten",
),
link_name = "__errno_location"
)]
Expand Down

0 comments on commit e0107c0

Please sign in to comment.