-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.nims
44 lines (33 loc) · 1.39 KB
/
config.nims
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
import strutils, ospaths
mode = ScriptMode.Verbose
proc getEnvOrRaise(envKey: string): string =
if existsEnv(envKey):
result = getEnv(envKey)
else:
raise newException(OSError, "Mandatory environment variable is not set: " & envKey)
proc paramString(): string =
result = ""
for i in 1 .. <paramCount():
result &= " " & paramStr(i)
proc getThisDir(): string =
(when defined(windows): thisDir().capitalize() else: thisDir())
let nimUE4LibDir = getEnvOrRaise("NIMUE_HOME")
let engineDir = getEnvOrRaise("UE4_HOME")
const uebuildPath = nimUE4LibDir / "tools" / "uebuild" / "uebuild"
exec "nim c -d:release --opt:speed \"$#.nim\"" % uebuildPath
task build, "rebuild editor for the current platform in Development mode":
withDir nimUE4LibDir:
exec "$# -e \"$#\" -d \"$#\" recompile $#" %
[uebuildPath, engineDir, getThisDir(), paramString()]
task deploy, "hot deployment":
withDir nimUE4LibDir:
exec "$# -e \"$#\" -d \"$#\" deploy $#" %
[uebuildPath, engineDir, getThisDir(), paramString()]
task clean, "clean Nim and Unreal generated files":
withDir nimUE4LibDir:
exec "$# -e \"$#\" -d \"$#\" clean $#" %
[uebuildPath, engineDir, getThisDir(), paramString()]
task compilenim, "compile only Nim files, without invoking UBT":
withDir nimUE4LibDir:
exec "$# -e \"$#\" -d \"$#\" compilenim $#" %
[uebuildPath, engineDir, getThisDir(), paramString()]