Add configurable compiler to global section

This commit is contained in:
Joey Yakimowich-Payne 2018-06-14 17:13:46 +09:00
commit 0f73ad6d3f

View file

@ -7,6 +7,8 @@ var
gConfig: Config gConfig: Config
gFilter = "" gFilter = ""
gQuotes = true gQuotes = true
gCppCompiler = "g++"
gCCompiler = "gcc"
gOutput = "" gOutput = ""
gIncludes: seq[string] = @[] gIncludes: seq[string] = @[]
gExcludes: seq[string] = @[] gExcludes: seq[string] = @[]
@ -369,7 +371,7 @@ proc getDefines(file: string, inline=false): string =
proc runPreprocess(file, ppflags, flags: string, inline: bool): string = proc runPreprocess(file, ppflags, flags: string, inline: bool): string =
var var
pproc = if flags.contains("cpp"): "g++" else: "gcc" pproc = if flags.contains("cpp"): gCppCompiler else: gCCompiler
cmd = "$# -E $# $#" % [pproc, ppflags, file] cmd = "$# -E $# $#" % [pproc, ppflags, file]
for inc in gIncludes: for inc in gIncludes:
@ -671,6 +673,11 @@ proc runCfg(cfg: string) =
quit(1) quit(1)
createDir(gOutput) createDir(gOutput)
if gConfig["n.global"].hasKey("cpp_compiler"):
gCppCompiler = gConfig["n.global"]["cpp_compiler"]
if gConfig["n.global"].hasKey("c_compiler"):
gCCompiler = gConfig["n.global"]["c_compiler"]
if gConfig["n.global"].hasKey("filter"): if gConfig["n.global"].hasKey("filter"):
gFilter = gConfig["n.global"]["filter"] gFilter = gConfig["n.global"]["filter"]
if gConfig["n.global"].hasKey("quotes"): if gConfig["n.global"].hasKey("quotes"):