mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-22 12:30:46 +00:00
fixes #11306
This commit is contained in:
@@ -138,12 +138,12 @@ compiler vcc:
|
||||
optSize: " /O1 /G7 ",
|
||||
compilerExe: "cl",
|
||||
cppCompiler: "cl",
|
||||
compileTmpl: "/c $options $include /Fo$objfile $file",
|
||||
compileTmpl: "/c$vccplatform$options $include /Fo$objfile $file",
|
||||
buildGui: " /link /SUBSYSTEM:WINDOWS ",
|
||||
buildDll: " /LD",
|
||||
buildLib: "lib /OUT:$libfile $objfiles",
|
||||
linkerExe: "cl",
|
||||
linkTmpl: "$options $builddll /Fe$exefile $objfiles $buildgui",
|
||||
linkTmpl: "$options $builddll$vccplatform /Fe$exefile $objfiles $buildgui",
|
||||
includeCmd: " /I",
|
||||
linkDirCmd: " /LIBPATH:",
|
||||
linkLibCmd: " $1.lib",
|
||||
@@ -528,6 +528,19 @@ proc cFileSpecificOptions(conf: ConfigRef; nimname: string): string =
|
||||
proc getCompileOptions(conf: ConfigRef): string =
|
||||
result = cFileSpecificOptions(conf, "__dummy__")
|
||||
|
||||
proc vccplatform(conf: ConfigRef): string =
|
||||
# VCC specific but preferable over the config hacks people
|
||||
# had to do before, see #11306
|
||||
case conf.target.targetCPU
|
||||
of cpuI386:
|
||||
result = " --platform:x86"
|
||||
of cpuArm:
|
||||
result = " --platform:arm"
|
||||
of cpuAmd64:
|
||||
result = " --platform:amd64"
|
||||
else:
|
||||
result = ""
|
||||
|
||||
proc getLinkOptions(conf: ConfigRef): string =
|
||||
result = conf.linkOptions & " " & conf.linkOptionsCmd & " "
|
||||
for linkedLib in items(conf.cLinkedLibs):
|
||||
@@ -611,7 +624,8 @@ proc getCompileCFileCmd*(conf: ConfigRef; cfile: Cfile, isMainFile = false): str
|
||||
"file", cfsh, "objfile", objfile,
|
||||
"options", options, "include", includeCmd,
|
||||
"nim", quoteShell(getPrefixDir(conf)),
|
||||
"lib", quoteShell(conf.libpath)])
|
||||
"lib", quoteShell(conf.libpath),
|
||||
"vccplatform", vccplatform(conf)])
|
||||
|
||||
proc footprint(conf: ConfigRef; cfile: Cfile): SecureHash =
|
||||
result = secureHash(
|
||||
@@ -716,7 +730,8 @@ proc getLinkCmd(conf: ConfigRef; output: AbsoluteFile,
|
||||
"buildgui", buildgui, "options", linkOptions,
|
||||
"objfiles", objfiles, "exefile", exefile,
|
||||
"nim", quoteShell(getPrefixDir(conf)),
|
||||
"lib", quoteShell(conf.libpath)])
|
||||
"lib", quoteShell(conf.libpath),
|
||||
"vccplatform", vccplatform(conf)])
|
||||
# On windows the debug information for binaries is emitted in a separate .pdb
|
||||
# file and the binaries (.dll and .exe) contain a full path to that .pdb file.
|
||||
# This is a problem for hot code reloading because even when we copy the .dll
|
||||
|
||||
@@ -223,7 +223,7 @@ clang.options.speed = "-O3"
|
||||
clang.options.size = "-Os"
|
||||
|
||||
@if windows:
|
||||
clang_cl.cpp.options.always %= "${clang_cl.options.always} /EHsc"
|
||||
clang_cl.cpp.options.always %= "${clang_cl.options.always} /EHsc"
|
||||
@if not release:
|
||||
clang_cl.options.linker = "/Z7"
|
||||
clang_cl.cpp.options.linker = "/Z7"
|
||||
@@ -246,20 +246,6 @@ vcc.cpp.exe = "vccexe.exe"
|
||||
vcc.linkerexe = "vccexe.exe"
|
||||
vcc.cpp.linkerexe = "vccexe.exe"
|
||||
|
||||
# set the options for cross compiles. (hostCPU != targetCPU)
|
||||
i386.windows.vcc.options.always = "/nologo --platform:x86"
|
||||
amd64.windows.vcc.options.always = "/nologo --platform:amd64"
|
||||
arm.windows.vcc.options.always = "/nologo --platform:arm"
|
||||
|
||||
# set the options for specific platforms:
|
||||
@if i386:
|
||||
vcc.options.always %= "${i386.windows.vcc.options.always}"
|
||||
@elif amd64:
|
||||
vcc.options.always %= "${amd64.windows.vcc.options.always}"
|
||||
@elif arm:
|
||||
vcc.options.always %= "${arm.windows.vcc.options.always}"
|
||||
@end
|
||||
|
||||
vcc.cpp.options.always = "/EHsc"
|
||||
vcc.options.linker.always = "/F33554432" # set the stack size to 32 MiB
|
||||
vcc.options.debug = "/Zi /FS /Od"
|
||||
|
||||
Reference in New Issue
Block a user