-
Notifications
You must be signed in to change notification settings - Fork 1
/
feud.nimble
93 lines (73 loc) · 1.94 KB
/
feud.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Package
version = "0.1.0"
author = "genotrance"
description = "Fed Ep with UDitors"
license = "MIT"
# Dependencies
requires "nim >= 0.19.0", "c2nim >= 0.9.14", "nimterop#v020"
requires "cligen >= 0.9.17", "winim >= 2.5.2", "xml >= 0.1.2"
import strutils
var
dll = ".dll"
exe = ".exe"
flags = "--opt:speed"
when defined(Linux):
dll = ".so"
exe = ""
elif defined(OSX):
dll = ".dylib"
exe = ""
task cleandll, "Clean DLLs":
for dir in @["plugins", "plugins/client", "plugins/server"]:
for file in dir.listFiles():
if dll in file:
rmFile file
task clean, "Clean all":
var
exe =
when defined(Windows):
".exe"
else:
""
rmFile "feud" & exe
rmFile "feudc" & exe
cleandllTask()
proc echoExec(cmd: string) =
echo cmd
exec cmd
proc stripDlls(path: string) =
for file in listFiles(path):
if dll in file:
exec "strip -s " & file
proc buildDlls(path: string) =
for file in listFiles(path):
if file[^4 .. ^1] == ".nim":
echo "Building " & file
echoExec "nim c --app:lib " & flags & " " & file
proc execDlls(task: proc(path: string)) =
for dir in ["plugins", "plugins/server", "plugins/client"]:
task(dir)
task dll, "Build dlls":
execDlls(buildDlls)
if "debug" notin flags:
execDlls(stripDlls)
task bin, "Build binaries":
echoExec "nim c " & flags & " feudc"
echoExec "nim c " & flags & " feud"
if "debug" notin flags:
echoExec "strip -s feudc" & exe
echoExec "strip -s feud" & exe
task release, "Release build":
dllTask()
binTask()
task binary, "Release binary":
flags = "-d:binary " & flags
releaseTask()
task debug, "Debug build":
flags = "--debugger:native --debuginfo -d:useGcAssert -d:useSysAssert --lineTrace:on"
releaseTask()
task dbin, "Debug binaries":
flags = "--debugger:native --debuginfo -d:useGcAssert -d:useSysAssert --lineTrace:on"
binTask()
task test, "Tester":
echoExec "nim tests/test.nims"