mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-03 22:13:12 +00:00
Pass build parameters to the task build library
This commit is contained in:
parent
221c7e19aa
commit
3749dceba1
7
Makefile
7
Makefile
@ -250,7 +250,12 @@ clean: | clean-nph
|
||||
|
||||
STATIC ?= 0
|
||||
|
||||
libcodex: deps
|
||||
ifneq ($(strip $(CODEX_LIB_PARAMS)),)
|
||||
NIM_PARAMS := $(NIM_PARAMS) $(CODEX_LIB_PARAMS)
|
||||
endif
|
||||
|
||||
libcodex:
|
||||
$(MAKE) deps
|
||||
rm -f build/libcodex*
|
||||
|
||||
ifeq ($(STATIC), 1)
|
||||
|
||||
23
build.nims
23
build.nims
@ -28,16 +28,15 @@ proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
|
||||
proc buildLibrary(name: string, srcDir = "./", params = "", `type` = "dynamic") =
|
||||
if not dirExists "build":
|
||||
mkDir "build"
|
||||
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
|
||||
var extra_params = params
|
||||
|
||||
if `type` == "dynamic":
|
||||
exec "nim c" & " --out:build/" & name &
|
||||
".so --threads:on --app:lib --opt:size --noMain --mm:refc --header --d:metrics --nimMainPrefix:libcodex --skipParentCfg:on -d:noSignalHandler -d:LeopardCmakeFlags=\"-DCMAKE_POSITION_INDEPENDENT_CODE=ON\" -d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE -d:chronicles_sinks=textlines[dynamic],json[dynamic],textlines[dynamic]" &
|
||||
extra_params & " " & srcDir & name & ".nim"
|
||||
params & " " & srcDir & name & ".nim"
|
||||
else:
|
||||
exec "nim c" & " --out:build/" & name &
|
||||
".a --threads:on --app:staticlib --opt:size --noMain --mm:refc --header --d:metrics --nimMainPrefix:libcodex --skipParentCfg:on -d:noSignalHandler -d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE -d:chronicles_sinks=textlines[dynamic],json[dynamic],textlines[dynamic]" &
|
||||
extra_params & " " & srcDir & name & ".nim"
|
||||
params & " " & srcDir & name & ".nim"
|
||||
|
||||
proc test(name: string, srcDir = "tests/", params = "", lang = "c") =
|
||||
buildBinary name, srcDir, params
|
||||
@ -137,9 +136,21 @@ task showCoverage, "open coverage html":
|
||||
exec("open coverage/report/index.html")
|
||||
|
||||
task libcodexDynamic, "Generate bindings":
|
||||
var params = ""
|
||||
when compiles(commandLineParams):
|
||||
for param in commandLineParams():
|
||||
if param.len > 0 and param.startsWith("-"):
|
||||
params.add " " & param
|
||||
|
||||
let name = "libcodex"
|
||||
buildLibrary name, "library/", "", "dynamic"
|
||||
buildLibrary name, "library/", params, "dynamic"
|
||||
|
||||
task libcodextatic, "Generate bindings":
|
||||
var params = ""
|
||||
when compiles(commandLineParams):
|
||||
for param in commandLineParams():
|
||||
if param.len > 0 and param.startsWith("-"):
|
||||
params.add " " & param
|
||||
|
||||
let name = "libcodex"
|
||||
buildLibrary name, "library/", "", "static"
|
||||
buildLibrary name, "library/", params, "static"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user