-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaynim.nimble
28 lines (20 loc) · 906 Bytes
/
playnim.nimble
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
# Package
version = "0.1.0"
author = "Gabben"
description = "A new awesome Nim playground"
license = "MIT"
srcDir = "src"
# Dependencies
requires "nim >= 1.0.0"
requires "nimscripter"
requires "karax"
import strformat
let
pass = "-O3 -flto -s INLINING_LIMIT -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS=_main,_runScript -s EXPORTED_RUNTIME_METHODS=ccall"
passC = pass
passL = pass & &" --pre-js public/assets/worker.js --preload-file ~/.choosenim/toolchains/nim-{NIM_VERSION}/lib"
wasmOut = &"./public/assets/{NIM_VERSION}.js"
task frontend, "Build frontend":
exec "nim js -d:release -d:danger -o:./public/assets/frontend.js src/frontend"
task wasm, "Compile WASM for current version of Nim":
exec &"nim c -d:release -d:danger --gc:none -d:useMalloc -d:emscripten --os:linux --out={wasmOut} --passC=\"{passC}\" --passL=\"{passL}\" src/nimscript"