2021-09-08 18:05:39 +00:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
|
|
|
version = "0.1.0"
|
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
description = "WIP refactor to extract business logic from status-desktop into a reusable library"
|
|
|
|
license = "MIT"
|
|
|
|
skipDirs = @["test"]
|
|
|
|
|
|
|
|
requires "nim >= 1.2.0"
|
2021-09-28 21:00:43 +00:00
|
|
|
|
|
|
|
import strutils
|
|
|
|
|
|
|
|
const release_opts =
|
|
|
|
" --define:danger" &
|
|
|
|
" --define:strip" &
|
|
|
|
" --hints:off" &
|
|
|
|
" --opt:size" &
|
|
|
|
" --passC:-flto" &
|
|
|
|
" --passL:-flto"
|
|
|
|
|
|
|
|
const debug_opts =
|
|
|
|
" --debugger:native" &
|
|
|
|
" --define:chronicles_line_numbers" &
|
|
|
|
" --define:debug" &
|
|
|
|
" --linetrace:on" &
|
|
|
|
" --stacktrace:on"
|
|
|
|
|
|
|
|
proc buildAndRun(name: string,
|
|
|
|
srcDir = "test_nim/",
|
|
|
|
outDir = "test_nim/build/",
|
|
|
|
params = "",
|
|
|
|
cmdParams = "",
|
|
|
|
lang = "c") =
|
|
|
|
mkDir outDir
|
|
|
|
exec "nim " &
|
|
|
|
lang &
|
|
|
|
(if getEnv("RELEASE").strip != "false": release_opts else: debug_opts) &
|
2021-09-29 12:52:30 +00:00
|
|
|
(if defined(windows): " --define:usePcreHeader" else: "") &
|
2021-09-28 21:00:43 +00:00
|
|
|
" --define:ssl" &
|
2021-09-29 12:52:30 +00:00
|
|
|
" --nimcache:nimcache/" & (if getEnv("RELEASE").strip != "false": "release/" else: "debug/") & name &
|
|
|
|
(if getEnv("PCRE_LDFLAGS").strip != "": " --passL:\"" & getEnv("PCRE_LDFLAGS") & "\"" else: "") &
|
|
|
|
" --passL:\"-L" & getEnv("STATUSGO_LIBDIR") & " -lstatus \"" &
|
2021-10-04 21:21:07 +00:00
|
|
|
" --passL:\"-L" & getEnv("KEYCARDGO_LIBDIR") & " -lkeycard \"" &
|
2021-09-28 21:00:43 +00:00
|
|
|
" --out:" & outDir & name &
|
|
|
|
" " &
|
|
|
|
srcDir & name & ".nim"
|
|
|
|
if defined(macosx):
|
|
|
|
exec "install_name_tool -add_rpath " & getEnv("STATUSGO_LIBDIR") & " " & outDir & name
|
|
|
|
exec "install_name_tool -change " & "libstatus." & getEnv("LIBSTATUS_EXT") & " @rpath/libstatus." & getEnv("LIBSTATUS_EXT") & " " & outDir & name
|
2021-10-04 21:21:07 +00:00
|
|
|
exec "install_name_tool -add_rpath " & getEnv("KEYCARDGO_LIBDIR") & " " & outDir & name
|
|
|
|
exec "install_name_tool -change " & "libkeycard." & getEnv("LIBKEYCARD_EXT") & " @rpath/libkeycard." & getEnv("LIBKEYCARD_EXT") & " " & outDir & name
|
2021-09-28 21:00:43 +00:00
|
|
|
if getEnv("RUN_AFTER_BUILD").strip != "false":
|
|
|
|
exec outDir & name
|
|
|
|
|
|
|
|
task tests, "Build and run all tests":
|
|
|
|
rmDir "test_nim/build/"
|
|
|
|
buildAndRun "test_all"
|