2024-01-10 20:14:13 +00:00
|
|
|
### Helper functions
|
|
|
|
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
|
|
|
|
if not dirExists "build":
|
|
|
|
mkDir "build"
|
|
|
|
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
|
|
|
|
var extra_params = params
|
|
|
|
for i in 2..<paramCount():
|
|
|
|
extra_params &= " " & paramStr(i)
|
|
|
|
exec "nim " & lang & " --out:build/" & name & " " & extra_params & " " & srcDir & name & ".nim"
|
|
|
|
|
|
|
|
proc buildLibrary(name: string, srcDir = "./", params = "", `type` = "static") =
|
|
|
|
if not dirExists "build":
|
|
|
|
mkDir "build"
|
|
|
|
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
|
|
|
|
var extra_params = params
|
|
|
|
for i in 2..<paramCount():
|
|
|
|
extra_params &= " " & paramStr(i)
|
|
|
|
if `type` == "static":
|
|
|
|
exec "nim c" & " --out:build/" & name & ".a --threads:on --app:staticlib --opt:size --noMain --header " & extra_params & " " & srcDir & name & ".nim"
|
|
|
|
else:
|
|
|
|
exec "nim c" & " --out:build/" & name & ".so --threads:on --app:lib --opt:size --noMain --header " & extra_params & " " & srcDir & name & ".nim"
|
|
|
|
|
|
|
|
### Tasks
|
|
|
|
task wakuUtils, "Building Waku Utils":
|
|
|
|
buildBinary "waku_handshake_utils", "libs/waku-utils/"
|
|
|
|
|
|
|
|
task wakuUtilsExamples, "Building Waku Utils Examples":
|
2024-02-10 00:53:59 +00:00
|
|
|
buildBinary "agentA", "libs/waku-utils/example/nwaku/"
|
|
|
|
buildBinary "agentB", "libs/waku-utils/example/nwaku/"
|
2024-02-08 16:05:23 +00:00
|
|
|
buildBinary "initiator", "libs/waku-utils/example/js-waku/"
|