initial workspace setup
This commit is contained in:
parent
c8e1170975
commit
61dd08bf96
|
@ -0,0 +1,16 @@
|
|||
[package]
|
||||
name = "nemu"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = ["Antifallobst <antifallobst@systemausfall.org>", "Eric-Paul Ickhorn <atnx@protonmail.com"]
|
||||
description = "A small web emulator for simple architectures"
|
||||
license = "MIT"
|
||||
repository = "https://git.nerdcult.net/nerdcult/nerdemu"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
wasm-bindgen = "0.2"
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
|
||||
nemu_build() {
|
||||
echo " --> Building NerdEMU"
|
||||
wasm-pack build --target web
|
||||
}
|
||||
|
||||
nemu_run(){
|
||||
echo " --> Starting HTTP server"
|
||||
python3 -m http.server
|
||||
}
|
||||
|
||||
echo "!=====[ NerdEMU build script ]=====!"
|
||||
|
||||
nemu_build
|
||||
|
||||
case $1 in
|
||||
"test")
|
||||
nemu_run
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "!=====[ Finished ]=====!"
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>test</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="module">
|
||||
import init, { greet } from "./pkg/nemu.js";
|
||||
init().then(() => {
|
||||
greet("NerdEMU");
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern {
|
||||
pub fn alert(s: &str);
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn greet(name: &str) {
|
||||
alert(&format!("Hello, {}!", name));
|
||||
}
|
Reference in New Issue