-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
347 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,42 @@ | ||
import os, strUtils | ||
|
||
var nim = paramStr(0) | ||
var nimargs = newSeq[string](0) | ||
var nimuserargs = newSeq[string](0) | ||
var script = "" | ||
var args = newSeq[string](0) | ||
var qexDir = thisDir().parentDir | ||
|
||
for i in 1..paramCount(): | ||
let p = paramStr(i) | ||
if p[0]=='-': | ||
nimargs.add p | ||
nimuserargs.add p | ||
elif p[0]==':': | ||
let t = p[1..^1] | ||
if t[0]=='-': | ||
nimuserargs.add t | ||
else: | ||
nimuserargs.add "-d:" & t | ||
else: | ||
if script=="": script = p | ||
else: args.add p | ||
|
||
echo "Using Nim: ", nim | ||
echo "Nim user args: ", nimargs | ||
echo "Nim user args: ", nimuserargs | ||
echo "Makefile script: ", script | ||
echo "Script args: ", args | ||
echo "QEX dir: ", qexDir | ||
|
||
include "buildTasks.nims" | ||
|
||
var iarg = 0 | ||
while iarg<args.len: | ||
currentArg = args[iarg] | ||
var found = false | ||
for t in configTasks: | ||
#echo t.cmd | ||
if args[iarg].len>=t.cmd.len and args[iarg][0..(t.cmd.len-1)] == t.cmd: | ||
echo "Processing config arg: ", currentArg | ||
found = true | ||
t.f() | ||
if not found: break # assume it is a build arg | ||
inc iarg | ||
setUserNimFlags(nimuserargs) | ||
let cmdargs = parseOpts(args) | ||
|
||
if iarg == args.len: | ||
for t in buildTasks: | ||
if t.cmd == "help": | ||
t.f() | ||
|
||
while iarg<args.len: | ||
currentArg = args[iarg] | ||
echo "Processing build arg: ", currentArg | ||
var found = false | ||
for t in buildTasks: | ||
if args[iarg].len>=t.cmd.len and args[iarg][0..(t.cmd.len-1)] == t.cmd: | ||
found = true | ||
t.f() | ||
if not found: # check if source | ||
let failed = tryBuildSource(currentArg) | ||
if failed: | ||
echo "Error: invalid build arg: ", currentArg | ||
quit(1) | ||
inc iarg | ||
if cmdargs.len == 0: | ||
runTask("help") | ||
else: | ||
var t = getTask(cmdargs[0]) | ||
if t.cmd == "": | ||
runMake(cmdargs) | ||
else: | ||
let cargs = cmdargs[1..^1] | ||
runTask(t, cargs) |
Oops, something went wrong.