Make c/cpp compiler priority .cfg > CC/CXX > gcc/g++
This commit is contained in:
parent
76020e8f21
commit
17e54d3b87
1 changed files with 15 additions and 2 deletions
17
nimgen.nim
17
nimgen.nim
|
|
@ -1,5 +1,11 @@
|
||||||
import nre, os, ospaths, osproc, parsecfg, pegs, ropes, sequtils, streams, strutils, tables
|
import nre, os, ospaths, osproc, parsecfg, pegs, ropes, sequtils, streams, strutils, tables
|
||||||
|
|
||||||
|
const
|
||||||
|
C_COMPILER_ENV = "CC"
|
||||||
|
CPP_COMPILER_ENV = "CPP"
|
||||||
|
DEFAULT_C_COMPILER = "gcc"
|
||||||
|
DEFAULT_CPP_COMPILER = "g++"
|
||||||
|
|
||||||
var
|
var
|
||||||
gDoneRecursive: seq[string] = @[]
|
gDoneRecursive: seq[string] = @[]
|
||||||
gDoneInline: seq[string] = @[]
|
gDoneInline: seq[string] = @[]
|
||||||
|
|
@ -8,8 +14,8 @@ var
|
||||||
gConfig: Config
|
gConfig: Config
|
||||||
gFilter = ""
|
gFilter = ""
|
||||||
gQuotes = true
|
gQuotes = true
|
||||||
gCppCompiler = "g++"
|
gCppCompiler = getEnv(CPP_COMPILER_ENV, DEFAULT_C_COMPILER)
|
||||||
gCCompiler = "gcc"
|
gCCompiler = getEnv(C_COMPILER_ENV, DEFAULT_CPP_COMPILER)
|
||||||
gOutput = ""
|
gOutput = ""
|
||||||
gIncludes: seq[string] = @[]
|
gIncludes: seq[string] = @[]
|
||||||
gExcludes: seq[string] = @[]
|
gExcludes: seq[string] = @[]
|
||||||
|
|
@ -719,8 +725,15 @@ proc runCfg(cfg: string) =
|
||||||
|
|
||||||
if gConfig["n.global"].hasKey("cpp_compiler"):
|
if gConfig["n.global"].hasKey("cpp_compiler"):
|
||||||
gCppCompiler = gConfig["n.global"]["cpp_compiler"]
|
gCppCompiler = gConfig["n.global"]["cpp_compiler"]
|
||||||
|
else:
|
||||||
|
# Reset on a per project basis
|
||||||
|
gCppCompiler = getEnv(CPP_COMPILER_ENV, DEFAULT_CPP_COMPILER)
|
||||||
|
|
||||||
if gConfig["n.global"].hasKey("c_compiler"):
|
if gConfig["n.global"].hasKey("c_compiler"):
|
||||||
gCCompiler = gConfig["n.global"]["c_compiler"]
|
gCCompiler = gConfig["n.global"]["c_compiler"]
|
||||||
|
else:
|
||||||
|
# Reset on a per project basis
|
||||||
|
gCCompiler = getEnv(C_COMPILER_ENV, DEFAULT_C_COMPILER)
|
||||||
|
|
||||||
if gConfig["n.global"].hasKey("filter"):
|
if gConfig["n.global"].hasKey("filter"):
|
||||||
gFilter = gConfig["n.global"]["filter"]
|
gFilter = gConfig["n.global"]["filter"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue