Skip to content

Commit b15d2e6

Browse files
committed
Switch to using cargo for Rust build
1 parent 1921d42 commit b15d2e6

File tree

7 files changed

+37
-14
lines changed

7 files changed

+37
-14
lines changed

wasm_apps/rust/.cargo/config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[build]
2+
target = "wasm32-unknown-unknown"
3+
rustflags = [
4+
"-C", "link-args=-zstack-size=2048 -s",
5+
]

wasm_apps/rust/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "app"
3+
version = "0.1.0"
4+
authors = ["Volodymyr Shymanskyy <[email protected]>"]
5+
edition = "2018"
6+
7+
[lib]
8+
path = "src/app.rs"
9+
crate-type = ["cdylib"]
10+
11+
[dependencies]
12+
13+
[profile.dev]
14+
panic = "abort"
15+
16+
[profile.release]
17+
panic = "abort"
18+
opt-level = "s"
19+
codegen-units = 1
20+
lto = true
21+
#debug = true

wasm_apps/rust/app.wasm

0 Bytes
Binary file not shown.

wasm_apps/rust/app.wasm.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ unsigned char app_wasm[] = {
22
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x11, 0x04, 0x60,
33
0x02, 0x7f, 0x7f, 0x00, 0x60, 0x00, 0x00, 0x60, 0x01, 0x7f, 0x00, 0x60,
44
0x00, 0x01, 0x7f, 0x02, 0x4e, 0x04, 0x07, 0x61, 0x72, 0x64, 0x75, 0x69,
5-
0x6e, 0x6f, 0x05, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x00, 0x02, 0x07, 0x61,
6-
0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x07, 0x70, 0x69, 0x6e, 0x4d, 0x6f,
7-
0x64, 0x65, 0x00, 0x00, 0x07, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f,
8-
0x0c, 0x64, 0x69, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x57, 0x72, 0x69, 0x74,
9-
0x65, 0x00, 0x00, 0x07, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x09,
10-
0x67, 0x65, 0x74, 0x50, 0x69, 0x6e, 0x4c, 0x45, 0x44, 0x00, 0x03, 0x03,
5+
0x6e, 0x6f, 0x09, 0x67, 0x65, 0x74, 0x50, 0x69, 0x6e, 0x4c, 0x45, 0x44,
6+
0x00, 0x03, 0x07, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x07, 0x70,
7+
0x69, 0x6e, 0x4d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x07, 0x61, 0x72, 0x64,
8+
0x75, 0x69, 0x6e, 0x6f, 0x0c, 0x64, 0x69, 0x67, 0x69, 0x74, 0x61, 0x6c,
9+
0x57, 0x72, 0x69, 0x74, 0x65, 0x00, 0x00, 0x07, 0x61, 0x72, 0x64, 0x75,
10+
0x69, 0x6e, 0x6f, 0x05, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x00, 0x02, 0x03,
1111
0x02, 0x01, 0x01, 0x05, 0x03, 0x01, 0x00, 0x01, 0x06, 0x0d, 0x02, 0x7f,
1212
0x00, 0x41, 0x80, 0x10, 0x0b, 0x7f, 0x00, 0x41, 0x80, 0x10, 0x0b, 0x07,
1313
0x2e, 0x04, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x02, 0x00, 0x0a,
1414
0x5f, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x65, 0x6e, 0x64, 0x03, 0x00,
1515
0x0b, 0x5f, 0x5f, 0x68, 0x65, 0x61, 0x70, 0x5f, 0x62, 0x61, 0x73, 0x65,
1616
0x03, 0x01, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x00, 0x04, 0x0a,
17-
0x2a, 0x01, 0x28, 0x01, 0x01, 0x7f, 0x10, 0x03, 0x22, 0x00, 0x41, 0x01,
17+
0x2a, 0x01, 0x28, 0x01, 0x01, 0x7f, 0x10, 0x00, 0x22, 0x00, 0x41, 0x01,
1818
0x10, 0x01, 0x03, 0x40, 0x20, 0x00, 0x41, 0x01, 0x10, 0x02, 0x41, 0xe4,
19-
0x00, 0x10, 0x00, 0x20, 0x00, 0x41, 0x00, 0x10, 0x02, 0x41, 0x84, 0x07,
20-
0x10, 0x00, 0x0c, 0x00, 0x0b, 0x00, 0x0b
19+
0x00, 0x10, 0x03, 0x20, 0x00, 0x41, 0x00, 0x10, 0x02, 0x41, 0x84, 0x07,
20+
0x10, 0x03, 0x0c, 0x00, 0x0b, 0x00, 0x0b
2121
};
2222
unsigned int app_wasm_len = 223;

wasm_apps/rust/build.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Compile
2-
rustc -O --crate-type=cdylib \
3-
--target=wasm32-unknown-unknown \
4-
-C link-arg=-zstack-size=2048 \
5-
-C link-arg=-s \
6-
-o app.wasm app.rs
2+
cargo build --release
3+
cp ./target/wasm32-unknown-unknown/release/app.wasm ./
74

85
# Optimize (optional)
96
wasm-opt -O3 app.wasm -o app.wasm
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)