fixes compiler ignoring passC/passL args when setting --cc:compiler. (#5310)
This commit change the way passC/passL cmdline arg and setting in config files are parsed. They are added to a separate linkOptionsCmd/compileOptionsCmd and are inserted when compile/linking command list are requested.
This commit is contained in:
parent
8b10609452
commit
2aec5b6c49
2 changed files with 15 additions and 3 deletions
|
|
@ -509,10 +509,10 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) =
|
||||||
else: localError(info, errGuiConsoleOrLibExpectedButXFound, arg)
|
else: localError(info, errGuiConsoleOrLibExpectedButXFound, arg)
|
||||||
of "passc", "t":
|
of "passc", "t":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
if pass in {passCmd2, passPP}: extccomp.addCompileOption(arg)
|
if pass in {passCmd2, passPP}: extccomp.addCompileOptionCmd(arg)
|
||||||
of "passl", "l":
|
of "passl", "l":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
if pass in {passCmd2, passPP}: extccomp.addLinkOption(arg)
|
if pass in {passCmd2, passPP}: extccomp.addLinkOptionCmd(arg)
|
||||||
of "cincludes":
|
of "cincludes":
|
||||||
expectArg(switch, arg, pass, info)
|
expectArg(switch, arg, pass, info)
|
||||||
if pass in {passCmd2, passPP}: cIncludes.add arg.processPath(info)
|
if pass in {passCmd2, passPP}: cIncludes.add arg.processPath(info)
|
||||||
|
|
|
||||||
|
|
@ -392,6 +392,8 @@ type
|
||||||
var
|
var
|
||||||
externalToLink: TLinkedList # files to link in addition to the file
|
externalToLink: TLinkedList # files to link in addition to the file
|
||||||
# we compiled
|
# we compiled
|
||||||
|
linkOptionsCmd: string = ""
|
||||||
|
compileOptionsCmd: seq[string] = @[]
|
||||||
linkOptions: string = ""
|
linkOptions: string = ""
|
||||||
compileOptions: string = ""
|
compileOptions: string = ""
|
||||||
ccompilerpath: string = ""
|
ccompilerpath: string = ""
|
||||||
|
|
@ -450,6 +452,12 @@ proc addCompileOption*(option: string) =
|
||||||
if strutils.find(compileOptions, option, 0) < 0:
|
if strutils.find(compileOptions, option, 0) < 0:
|
||||||
addOpt(compileOptions, option)
|
addOpt(compileOptions, option)
|
||||||
|
|
||||||
|
proc addLinkOptionCmd*(option: string) =
|
||||||
|
addOpt(linkOptionsCmd, option)
|
||||||
|
|
||||||
|
proc addCompileOptionCmd*(option: string) =
|
||||||
|
compileOptionsCmd.add(option)
|
||||||
|
|
||||||
proc initVars*() =
|
proc initVars*() =
|
||||||
# we need to define the symbol here, because ``CC`` may have never been set!
|
# we need to define the symbol here, because ``CC`` may have never been set!
|
||||||
for i in countup(low(CC), high(CC)): undefSymbol(CC[i].name)
|
for i in countup(low(CC), high(CC)): undefSymbol(CC[i].name)
|
||||||
|
|
@ -524,6 +532,10 @@ proc add(s: var string, many: openArray[string]) =
|
||||||
|
|
||||||
proc cFileSpecificOptions(cfilename: string): string =
|
proc cFileSpecificOptions(cfilename: string): string =
|
||||||
result = compileOptions
|
result = compileOptions
|
||||||
|
for option in compileOptionsCmd:
|
||||||
|
if strutils.find(result, option, 0) < 0:
|
||||||
|
addOpt(result, option)
|
||||||
|
|
||||||
var trunk = splitFile(cfilename).name
|
var trunk = splitFile(cfilename).name
|
||||||
if optCDebug in gGlobalOptions:
|
if optCDebug in gGlobalOptions:
|
||||||
var key = trunk & ".debug"
|
var key = trunk & ".debug"
|
||||||
|
|
@ -544,7 +556,7 @@ proc getCompileOptions: string =
|
||||||
result = cFileSpecificOptions("__dummy__")
|
result = cFileSpecificOptions("__dummy__")
|
||||||
|
|
||||||
proc getLinkOptions: string =
|
proc getLinkOptions: string =
|
||||||
result = linkOptions
|
result = linkOptions & " " & linkOptionsCmd & " "
|
||||||
for linkedLib in items(cLinkedLibs):
|
for linkedLib in items(cLinkedLibs):
|
||||||
result.add(CC[cCompiler].linkLibCmd % linkedLib.quoteShell)
|
result.add(CC[cCompiler].linkLibCmd % linkedLib.quoteShell)
|
||||||
for libDir in items(cLibs):
|
for libDir in items(cLibs):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue