Skip to content

Commit

Permalink
Compile Floretta to Wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
samestep committed Nov 20, 2024
1 parent 6b5d7c8 commit b1e5a45
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: cargo test
- run: cargo build --package=floretta-wasm --target=wasm32-unknown-unknown --release
- uses: actions/upload-artifact@v4
with:
name: floretta.wasm
path: target/wasm32-unknown-unknown/release/floretta_wasm.wasm
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions crates/floretta-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "floretta-wasm"
private = true
version.workspace = true
edition.workspace = true

[lib]
crate-type = ["cdylib"]

[dependencies]
floretta.workspace = true
4 changes: 4 additions & 0 deletions crates/floretta-wasm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#[no_mangle]
fn autodiff(wasm_module: &[u8]) -> Result<Vec<u8>, floretta::Error> {
floretta::Autodiff::new().transform(wasm_module)
}
4 changes: 4 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[toolchain]
channel = "stable"
profile = "default"
targets = ["wasm32-unknown-unknown"]

0 comments on commit b1e5a45

Please sign in to comment.