diff options
-rw-r--r-- | config/nim.cfg | 12 | ||||
-rw-r--r-- | tools/vccenv/vccexe.nim | 53 |
2 files changed, 32 insertions, 33 deletions
diff --git a/config/nim.cfg b/config/nim.cfg index c054deeb3..ada7212f9 100644 --- a/config/nim.cfg +++ b/config/nim.cfg @@ -182,14 +182,14 @@ vcc.linkerexe = "vccexe.exe" # set the options for specific platforms: @if i386: -vcc.options.always = "/nologo /vcvars:platform:x86" -vcc.options.linker.always = "/nologo /vcvars:platform:x86" +vcc.options.always = "--platform:x86 /nologo" +vcc.options.linker.always = "--platform:x86 /nologo" @elif amd64: -vcc.options.always = "/nologo /vcvars:platform:amd64" -vcc.options.linker.always = "/nologo /vcvars:platform:amd64" +vcc.options.always = "--platform:am64 /nologo" +vcc.options.linker.always = "--platform:amd64 /nologo" @elif arm: -vcc.options.always = "/nologo /vcvars:platform:arm" -vcc.options.linker.always = "/nologo /vcvars:platform:arm" +vcc.options.always = "--platform:arm /nologo" +vcc.options.linker.always = "--platform:arm /nologo" @else: vcc.options.always = "/nologo" vcc.options.linker.always = "/nologo" diff --git a/tools/vccenv/vccexe.nim b/tools/vccenv/vccexe.nim index 3193dbbba..bbac117df 100644 --- a/tools/vccenv/vccexe.nim +++ b/tools/vccenv/vccexe.nim @@ -1,4 +1,4 @@ -import strutils, strtabs, os, osproc, vccenv +import strutils, strtabs, os, osproc, parseopt, vccenv when defined(release): let vccOptions = {poParentStreams} @@ -6,15 +6,13 @@ else: let vccOptions = {poEchoCmd, poParentStreams} const - vcvarsArgPrefix = "vcvars:" - platformArgPrefix = "platform:" - storeArgPrefix = "store" - sdkArgPrefix = "sdk:" - vcvarsArgIdx = 1 # vcvars comes after - or / char in argument - argsToken1Idx = vcvarsArgIdx + vcvarsArgPrefix.len - platformArgValueIdx = argsToken1Idx + platformArgPrefix.len - sdkArgValueIdx = argsToken1Idx + sdkArgPrefix.len + platformPrefix = "--platform" + winstorePrefix = "--winstore" + sdkversionPrefix = "--sdkversion" + platformSepIdx = platformPrefix.len + sdkversionSepIdx = sdkversionPrefix.len + HelpText = """ +-----------------------------------------------------------------+ | Microsoft C/C++ compiler wrapper for Nim | @@ -24,32 +22,33 @@ const Usage: vccexe [options] [compileroptions] Options: - /vcvars:platform:<arch> Specify the Compiler Platform Tools architecture - <arch>: x86 | amd64 | arm | x86_amd64 | x86_arm | amd64_x86 | amd64_arm - /vcvars:store Use Windows Store (rather than desktop) development tools - /vcvars:sdk:<version> Use a specific Windows SDK version: - <version> is either the full Windows 10 SDK version number or - "8.1" to use the windows 8.1 SDK + --platform:<arch> Specify the Compiler Platform Tools architecture + <arch>: x86 | amd64 | arm | x86_amd64 | x86_arm | amd64_x86 | amd64_arm + --winstore Use Windows Store (rather than desktop) development tools + --sdkversion:<v> Use a specific Windows SDK version: + <v> is either the full Windows 10 SDK version number or + "8.1" to use the windows 8.1 SDK + +Other command line arguments are passed on to the +Microsoft C/C++ compiler for the specified SDK toolset """ when isMainModule: var platformArg: string = nil - var storeArg: bool = false var sdkVersionArg: string = nil + var storeArg: bool = false + var clArgs: seq[TaintedString] = @[] + var wrapperArgs = commandLineParams() for wargv in wrapperArgs: - # Check whether the current argument contains vcvars prefix - if cmpIgnoreCase(wargv.substr(vcvarsArgIdx, argsToken1Idx - 1), vcvarsArgPrefix) == 0: - # Check for platform - if cmpIgnoreCase(wargv.substr(argsToken1Idx, platformArgValueIdx - 1), platformArgPrefix) == 0: - platformArg = wargv.substr(platformArgValueIdx) - # Check for store - elif cmpIgnoreCase(wargv.substr(argsToken1Idx), storeArgPrefix) == 0: - storeArg = true - # Check for sdk - elif cmpIgnoreCase(wargv.substr(argsToken1Idx, sdkArgValueIdx - 1), sdkArgPrefix) == 0: - sdkVersionArg = wargv.substr(sdkArgValueIdx) + # Check whether the current argument contains -- prefix + if wargv.startsWith(platformPrefix): # Check for platform + platformArg = wargv.substr(platformSepIdx + 1) + elif wargv == winstorePrefix: # Check for winstore + storeArg = true + elif wargv.startsWith(sdkversionPrefix): # Check for sdkversion + sdkVersionArg = wargv.substr(sdkversionSepIdx + 1) else: # Regular cl.exe argument -> store for final cl.exe invocation if (wargv.len == 2) and (wargv[1] == '?'): echo HelpText |