-
Notifications
You must be signed in to change notification settings - Fork 10
/
wasm_rules.hancho
41 lines (39 loc) · 1.2 KB
/
wasm_rules.hancho
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
emcc = hancho.Config(
desc="Compile Emscripten'd {in_src}",
command="emcc {flags} {joined_includes} -c {in_src} -o {out_obj}",
flags=[
"-std=c++20",
"-O0",
"-g3",
"-gsource-map",
"-MMD",
"-sNO_DISABLE_EXCEPTION_CATCHING",
"-Wno-deprecated-declarations",
],
includes=None,
out_obj="{swap_ext(in_src, '.o')}",
joined_includes="{join_prefix('-I', includes)}",
)
emld = hancho.Config(
desc="Link Emscripten'd {rel(out_js)}",
command="emcc {flags} {in_objs} -o {out_js}",
flags=[
"-sEXPORT_ES6",
"-sEXPORTED_RUNTIME_METHODS=['FS','callMain']",
"-sNO_DISABLE_EXCEPTION_CATCHING",
"-sTOTAL_STACK=32MB",
"-sINITIAL_MEMORY=256MB",
"-sALLOW_MEMORY_GROWTH",
"-sFORCE_FILESYSTEM",
],
)
ems_package = hancho.Config(
desc="Package {rel(out_data)}",
command=[
"rm -f {out_data}",
"rm -f {out_js}",
"python3 $EMSDK/upstream/emscripten/tools/file_packager.py {out_data} {flags} --js-output={out_js} --preload {preloads} --exclude {excludes} 2> /dev/null",
],
flags="--no-node",
excludes="*.cpp *.sv *.MD *.hex *.pcf *.v *.txt *.hancho",
)