workaround against silly Windows command line length limitations for the upcoming megatest.nim
This commit is contained in:
parent
a5ecbf823f
commit
8896770f8f
2 changed files with 28 additions and 16 deletions
|
|
@ -763,6 +763,13 @@ proc execCmdsInParallel(conf: ConfigRef; cmds: seq[string]; prettyCb: proc (idx:
|
||||||
rawMessage(conf, errGenerated, "execution of an external program failed: '$1'" %
|
rawMessage(conf, errGenerated, "execution of an external program failed: '$1'" %
|
||||||
cmds.join())
|
cmds.join())
|
||||||
|
|
||||||
|
proc minimizeObjfileNameLen(fullObjName: AbsoluteFile, conf: ConfigRef): string =
|
||||||
|
# For OSes with command line length limitations we try to use relative
|
||||||
|
# paths over absolute ones:
|
||||||
|
result = relativeTo(fullObjName, getNimcacheDir(conf)).string
|
||||||
|
if result.len >= fullObjName.string.len:
|
||||||
|
result = fullObjName.string
|
||||||
|
|
||||||
proc callCCompiler*(conf: ConfigRef; projectfile: AbsoluteFile) =
|
proc callCCompiler*(conf: ConfigRef; projectfile: AbsoluteFile) =
|
||||||
var
|
var
|
||||||
linkCmd: string
|
linkCmd: string
|
||||||
|
|
@ -783,19 +790,24 @@ proc callCCompiler*(conf: ConfigRef; projectfile: AbsoluteFile) =
|
||||||
if optNoLinking notin conf.globalOptions:
|
if optNoLinking notin conf.globalOptions:
|
||||||
# call the linker:
|
# call the linker:
|
||||||
var objfiles = ""
|
var objfiles = ""
|
||||||
for it in conf.externalToLink:
|
let oldCwd = getCurrentDir()
|
||||||
let objFile = if noAbsolutePaths(conf): it.extractFilename else: it
|
try:
|
||||||
add(objfiles, ' ')
|
setCurrentDir(getNimcacheDir(conf).string)
|
||||||
add(objfiles, quoteShell(
|
for it in conf.externalToLink:
|
||||||
addFileExt(objFile, CC[conf.cCompiler].objExt)))
|
let objFile = if noAbsolutePaths(conf): it.extractFilename else: it
|
||||||
for x in conf.toCompile:
|
add(objfiles, ' ')
|
||||||
let objFile = if noAbsolutePaths(conf): x.obj.extractFilename else: x.obj.string
|
let fullObjName = AbsoluteFile addFileExt(objFile, CC[conf.cCompiler].objExt)
|
||||||
add(objfiles, ' ')
|
add(objfiles, quoteShell(minimizeObjfileNameLen(fullObjName, conf)))
|
||||||
add(objfiles, quoteShell(objFile))
|
for x in conf.toCompile:
|
||||||
|
let objFile = if noAbsolutePaths(conf): x.obj.extractFilename.AbsoluteFile else: x.obj
|
||||||
|
add(objfiles, ' ')
|
||||||
|
add(objfiles, quoteShell(minimizeObjfileNameLen(objFile, conf)))
|
||||||
|
|
||||||
linkCmd = getLinkCmd(conf, projectfile, objfiles)
|
linkCmd = getLinkCmd(conf, projectfile, objfiles)
|
||||||
if optCompileOnly notin conf.globalOptions:
|
if optCompileOnly notin conf.globalOptions:
|
||||||
execLinkCmd(conf, linkCmd)
|
execLinkCmd(conf, linkCmd)
|
||||||
|
finally:
|
||||||
|
setCurrentDir(oldCwd)
|
||||||
else:
|
else:
|
||||||
linkCmd = ""
|
linkCmd = ""
|
||||||
if optGenScript in conf.globalOptions:
|
if optGenScript in conf.globalOptions:
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@
|
||||||
|
|
||||||
when defined(gcc) and defined(windows):
|
when defined(gcc) and defined(windows):
|
||||||
when defined(x86):
|
when defined(x86):
|
||||||
{.link: "icons/nim.res".}
|
{.link: "../icons/nim.res".}
|
||||||
else:
|
else:
|
||||||
{.link: "icons/nim_icon.o".}
|
{.link: "../icons/nim_icon.o".}
|
||||||
|
|
||||||
when defined(amd64) and defined(windows) and defined(vcc):
|
when defined(amd64) and defined(windows) and defined(vcc):
|
||||||
{.link: "icons/nim-amd64-windows-vcc.res".}
|
{.link: "../icons/nim-amd64-windows-vcc.res".}
|
||||||
when defined(i386) and defined(windows) and defined(vcc):
|
when defined(i386) and defined(windows) and defined(vcc):
|
||||||
{.link: "icons/nim-i386-windows-vcc.res".}
|
{.link: "../icons/nim-i386-windows-vcc.res".}
|
||||||
|
|
||||||
import
|
import
|
||||||
commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes,
|
commands, lexer, condsyms, options, msgs, nversion, nimconf, ropes,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue