Skip to content

Commit b4545f0

Browse files
cooldomeAraq
authored andcommitted
pass platform argument only if vccexe is used (#13078)
* pass platform only if vccexe is used * fixes #12297
1 parent fadbd8f commit b4545f0

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

compiler/extccomp.nim

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -558,15 +558,14 @@ proc getCompileOptions(conf: ConfigRef): string =
558558
proc vccplatform(conf: ConfigRef): string =
559559
# VCC specific but preferable over the config hacks people
560560
# had to do before, see #11306
561-
case conf.target.targetCPU
562-
of cpuI386:
563-
result = " --platform:x86"
564-
of cpuArm:
565-
result = " --platform:arm"
566-
of cpuAmd64:
567-
result = " --platform:amd64"
568-
else:
569-
result = ""
561+
if conf.cCompiler == ccVcc:
562+
let exe = getConfigVar(conf, conf.cCompiler, ".exe")
563+
if "vccexe.exe" == extractFilename(exe):
564+
result = case conf.target.targetCPU
565+
of cpuI386: " --platform:x86"
566+
of cpuArm: " --platform:arm"
567+
of cpuAmd64: " --platform:amd64"
568+
else: ""
570569

571570
proc getLinkOptions(conf: ConfigRef): string =
572571
result = conf.linkOptions & " " & conf.linkOptionsCmd & " "
@@ -596,7 +595,7 @@ proc getLinkerExe(conf: ConfigRef; compiler: TSystemCC): string =
596595

597596
proc getCompileCFileCmd*(conf: ConfigRef; cfile: Cfile,
598597
isMainFile = false; produceOutput = false): string =
599-
var c = conf.cCompiler
598+
let c = conf.cCompiler
600599
# We produce files like module.nim.cpp, so the absolute Nim filename is not
601600
# cfile.name but `cfile.cname.changeFileExt("")`:
602601
var options = cFileSpecificOptions(conf, cfile.nimname, cfile.cname.changeFileExt("").string)

0 commit comments

Comments
 (0)