config(build): Add building utils
This commit is contained in:
parent
e8150ce1a3
commit
8488fa343c
10
Makefile
10
Makefile
|
@ -26,3 +26,13 @@ clean-librln:
|
||||||
|
|
||||||
# Extend clean target
|
# Extend clean target
|
||||||
clean: | clean-librln
|
clean: | clean-librln
|
||||||
|
|
||||||
|
##################
|
||||||
|
## WAKU UTILS ##
|
||||||
|
##################
|
||||||
|
|
||||||
|
waku-utils: | librln
|
||||||
|
nim wakuUtils $(NIM_PARAMS) nimbus_node_manager.nims
|
||||||
|
|
||||||
|
waku-utils-example: | librln
|
||||||
|
nim wakuUtilsExamples $(NIM_PARAMS) nimbus_node_manager.nims
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
### 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":
|
||||||
|
buildBinary "agentA", "libs/waku-utils/example/"
|
||||||
|
buildBinary "agentB", "libs/waku-utils/example/"
|
Loading…
Reference in New Issue