This commit is contained in:
Ganesh Viswanathan 2019-10-16 22:56:50 -05:00
commit f7bc37f2b3
2 changed files with 15 additions and 3 deletions

View file

@ -570,13 +570,25 @@ proc make*(path, check: string, flags = "", regex = false) =
doAssert findFile(check, path, regex = regex).len != 0, "# make failed"
proc getCompiler*(): string =
var
compiler =
when defined(gcc):
"gcc"
elif defined(clang):
"clang"
else:
doAssert false, "Nimterop only supports gcc and clang at this time"
result = getEnv("CC", compiler)
proc getGccPaths*(mode = "c"): seq[string] =
var
nul = when defined(Windows): "nul" else: "/dev/null"
mmode = if mode == "cpp": "c++" else: mode
inc = false
(outp, _) = gorgeEx(&"""{getEnv("CC", "gcc")} -Wp,-v -x{mmode} {nul}""")
(outp, _) = gorgeEx(&"""{getCompiler()} -Wp,-v -x{mmode} {nul}""")
for line in outp.splitLines():
if "#include <...> search starts here" in line:
@ -599,7 +611,7 @@ proc getGccLibPaths*(mode = "c"): seq[string] =
mmode = if mode == "cpp": "c++" else: mode
linker = when defined(OSX): "-Xlinker" else: ""
(outp, _) = gorgeEx(&"""{getEnv("CC", "gcc")} {linker} -v -x{mmode} {nul}""")
(outp, _) = gorgeEx(&"""{getCompiler()} {linker} -v -x{mmode} {nul}""")
for line in outp.splitLines():
if "LIBRARY_PATH=" in line:

View file

@ -204,7 +204,7 @@ proc removeStatic(content: string): string =
proc getPreprocessor*(gState: State, fullpath: string, mode = "cpp"): string =
var
mmode = if mode == "cpp": "c++" else: mode
cmd = &"""{getEnv("CC", "gcc")} -E -CC -dD -x{mmode} -w """
cmd = &"""{getCompiler()} -E -CC -dD -x{mmode} -w """
rdata: seq[string] = @[]
start = false