Skip to content

Commit

Permalink
only store uncompiled wast in tree
Browse files Browse the repository at this point in the history
  • Loading branch information
mystor committed Jan 12, 2020
1 parent c9560b8 commit 2921076
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ branch = "mycelium"
default-features = false
features = ["core"]

[build-dependencies]
wat = "1.0"

[package.metadata.bootimage]
default-target = "x86_64-mycelium.json"

Expand Down
12 changes: 12 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use std::env;
use std::fs;
use std::path::PathBuf;

fn main() -> Result<(), Box<std::error::Error>> {
let out_dir = PathBuf::from(env::var("OUT_DIR")?);

// Build our helloworld.wast into binary.
let binary = wat::parse_file("src/helloworld.wast")?;
fs::write(out_dir.join("helloworld.wasm"), &binary)?;
Ok(())
}
Binary file removed src/helloworld.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use alloc::vec::Vec;

mod wasm;

const HELLOWORLD_WASM: &[u8] = include_bytes!("helloworld.wasm");
const HELLOWORLD_WASM: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/helloworld.wasm"));

pub fn kernel_main<A>(bootinfo: &impl BootInfo<Arch = A>) -> !
where
Expand Down

0 comments on commit 2921076

Please sign in to comment.