compile external .c files with the C compiler, not with C++; refs #5357
This commit is contained in:
parent
a336bf2395
commit
f0aef9f4e2
1 changed files with 8 additions and 6 deletions
|
|
@ -566,16 +566,18 @@ proc needsExeExt(): bool {.inline.} =
|
||||||
result = (optGenScript in gGlobalOptions and targetOS == osWindows) or
|
result = (optGenScript in gGlobalOptions and targetOS == osWindows) or
|
||||||
(platform.hostOS == osWindows)
|
(platform.hostOS == osWindows)
|
||||||
|
|
||||||
proc getCompilerExe(compiler: TSystemCC): string =
|
proc getCompilerExe(compiler: TSystemCC; cfile: string): string =
|
||||||
result = if gCmd == cmdCompileToCpp: CC[compiler].cppCompiler
|
result = if gCmd == cmdCompileToCpp and not cfile.endsWith(".c"):
|
||||||
else: CC[compiler].compilerExe
|
CC[compiler].cppCompiler
|
||||||
|
else:
|
||||||
|
CC[compiler].compilerExe
|
||||||
if result.len == 0:
|
if result.len == 0:
|
||||||
rawMessage(errCompilerDoesntSupportTarget, CC[compiler].name)
|
rawMessage(errCompilerDoesntSupportTarget, CC[compiler].name)
|
||||||
|
|
||||||
proc getLinkerExe(compiler: TSystemCC): string =
|
proc getLinkerExe(compiler: TSystemCC): string =
|
||||||
result = if CC[compiler].linkerExe.len > 0: CC[compiler].linkerExe
|
result = if CC[compiler].linkerExe.len > 0: CC[compiler].linkerExe
|
||||||
elif gMixedMode and gCmd != cmdCompileToCpp: CC[compiler].cppCompiler
|
elif gMixedMode and gCmd != cmdCompileToCpp: CC[compiler].cppCompiler
|
||||||
else: compiler.getCompilerExe
|
else: compiler.getCompilerExe("")
|
||||||
|
|
||||||
proc getCompileCFileCmd*(cfile: Cfile): string =
|
proc getCompileCFileCmd*(cfile: Cfile): string =
|
||||||
var c = cCompiler
|
var c = cCompiler
|
||||||
|
|
@ -596,7 +598,7 @@ proc getCompileCFileCmd*(cfile: Cfile): string =
|
||||||
|
|
||||||
var options = cFileSpecificOptions(cfile.cname)
|
var options = cFileSpecificOptions(cfile.cname)
|
||||||
var exe = getConfigVar(c, ".exe")
|
var exe = getConfigVar(c, ".exe")
|
||||||
if exe.len == 0: exe = c.getCompilerExe
|
if exe.len == 0: exe = c.getCompilerExe(cfile.cname)
|
||||||
|
|
||||||
if needsExeExt(): exe = addFileExt(exe, "exe")
|
if needsExeExt(): exe = addFileExt(exe, "exe")
|
||||||
if optGenDynLib in gGlobalOptions and
|
if optGenDynLib in gGlobalOptions and
|
||||||
|
|
@ -614,7 +616,7 @@ proc getCompileCFileCmd*(cfile: Cfile): string =
|
||||||
compilePattern = joinPath(ccompilerpath, exe)
|
compilePattern = joinPath(ccompilerpath, exe)
|
||||||
else:
|
else:
|
||||||
includeCmd = ""
|
includeCmd = ""
|
||||||
compilePattern = c.getCompilerExe
|
compilePattern = c.getCompilerExe(cfile.cname)
|
||||||
|
|
||||||
var cf = if noAbsolutePaths(): extractFilename(cfile.cname)
|
var cf = if noAbsolutePaths(): extractFilename(cfile.cname)
|
||||||
else: cfile.cname
|
else: cfile.cname
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue