* Fix bug: vccexe finds oldest VCC * echo path to vcvarsall.bat as hint when failed to execute cl.exe
This commit is contained in:
parent
c60bb94647
commit
bad5ad6dc7
3 changed files with 22 additions and 11 deletions
|
|
@ -39,7 +39,7 @@ proc vccEnvVcVarsAllPath*(version: VccEnvVersion = vsUndefined): string =
|
|||
for tryVersion in [vs140, vs120, vs110, vs100, vs90]:
|
||||
let tryPath = vccEnvVcVarsAllPath(tryVersion)
|
||||
if tryPath.len > 0:
|
||||
result = tryPath
|
||||
return tryPath
|
||||
else: # Specific version requested
|
||||
let key = $version
|
||||
let val = getEnv key
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ const
|
|||
sdktypeSepIdx = sdktypePrefix.len
|
||||
sdkversionSepIdx = sdkversionPrefix.len
|
||||
|
||||
vcvarsallDefaultPath = "vcvarsall.bat"
|
||||
|
||||
helpText = """
|
||||
+-----------------------------------------------------------------+
|
||||
| Microsoft C/C++ compiler wrapper for Nim |
|
||||
|
|
@ -158,6 +160,10 @@ when isMainModule:
|
|||
vccversionValue = vccUndefined
|
||||
vcvarsallArg = discoverVccVcVarsAllPath()
|
||||
|
||||
if vcvarsallArg == "":
|
||||
# Assume that default executable is in current directory or in PATH
|
||||
vcvarsallArg = findExe(vcvarsallDefaultPath)
|
||||
|
||||
if printPathArg:
|
||||
var head = $vccversionValue
|
||||
if head.len < 1:
|
||||
|
|
@ -180,9 +186,16 @@ when isMainModule:
|
|||
|
||||
if not noCommandArg:
|
||||
# Run VCC command with the VCC process environment
|
||||
let vccProcess = startProcess(
|
||||
commandArg,
|
||||
args = clArgs,
|
||||
options = vccOptions
|
||||
)
|
||||
quit vccProcess.waitForExit()
|
||||
try:
|
||||
let vccProcess = startProcess(
|
||||
commandArg,
|
||||
args = clArgs,
|
||||
options = vccOptions
|
||||
)
|
||||
quit vccProcess.waitForExit()
|
||||
except:
|
||||
if vcvarsallArg.len != 0:
|
||||
echo "Hint: using " & vcvarsallArg
|
||||
else:
|
||||
echo "Hint: vcvarsall.bat was not found"
|
||||
raise
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import strtabs, strutils, os, osproc
|
|||
const
|
||||
comSpecEnvKey = "ComSpec" ## Environment Variable that specifies the command-line application path in Windows
|
||||
## Usually set to cmd.exe
|
||||
vcvarsallDefaultPath = "vcvarsall.bat"
|
||||
|
||||
type
|
||||
VccArch* = enum ## The VCC compile target architectures
|
||||
|
|
@ -48,11 +47,10 @@ proc vccVarsAll*(path: string, arch: VccArch = vccarchUnspecified, platform_type
|
|||
## verbose
|
||||
## Echo the command-line passed on to the system to load the VCC environment. Defaults to `false`.
|
||||
|
||||
var vccvarsallpath = path
|
||||
# Assume that default executable is in current directory or in PATH
|
||||
if path == "":
|
||||
vccvarsallpath = vcvarsallDefaultPath
|
||||
return nil
|
||||
|
||||
let vccvarsallpath = path
|
||||
var args: seq[string] = @[]
|
||||
|
||||
let archStr: string = $arch
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue