* 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]:
|
for tryVersion in [vs140, vs120, vs110, vs100, vs90]:
|
||||||
let tryPath = vccEnvVcVarsAllPath(tryVersion)
|
let tryPath = vccEnvVcVarsAllPath(tryVersion)
|
||||||
if tryPath.len > 0:
|
if tryPath.len > 0:
|
||||||
result = tryPath
|
return tryPath
|
||||||
else: # Specific version requested
|
else: # Specific version requested
|
||||||
let key = $version
|
let key = $version
|
||||||
let val = getEnv key
|
let val = getEnv key
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@ const
|
||||||
sdktypeSepIdx = sdktypePrefix.len
|
sdktypeSepIdx = sdktypePrefix.len
|
||||||
sdkversionSepIdx = sdkversionPrefix.len
|
sdkversionSepIdx = sdkversionPrefix.len
|
||||||
|
|
||||||
|
vcvarsallDefaultPath = "vcvarsall.bat"
|
||||||
|
|
||||||
helpText = """
|
helpText = """
|
||||||
+-----------------------------------------------------------------+
|
+-----------------------------------------------------------------+
|
||||||
| Microsoft C/C++ compiler wrapper for Nim |
|
| Microsoft C/C++ compiler wrapper for Nim |
|
||||||
|
|
@ -158,6 +160,10 @@ when isMainModule:
|
||||||
vccversionValue = vccUndefined
|
vccversionValue = vccUndefined
|
||||||
vcvarsallArg = discoverVccVcVarsAllPath()
|
vcvarsallArg = discoverVccVcVarsAllPath()
|
||||||
|
|
||||||
|
if vcvarsallArg == "":
|
||||||
|
# Assume that default executable is in current directory or in PATH
|
||||||
|
vcvarsallArg = findExe(vcvarsallDefaultPath)
|
||||||
|
|
||||||
if printPathArg:
|
if printPathArg:
|
||||||
var head = $vccversionValue
|
var head = $vccversionValue
|
||||||
if head.len < 1:
|
if head.len < 1:
|
||||||
|
|
@ -180,9 +186,16 @@ when isMainModule:
|
||||||
|
|
||||||
if not noCommandArg:
|
if not noCommandArg:
|
||||||
# Run VCC command with the VCC process environment
|
# Run VCC command with the VCC process environment
|
||||||
let vccProcess = startProcess(
|
try:
|
||||||
commandArg,
|
let vccProcess = startProcess(
|
||||||
args = clArgs,
|
commandArg,
|
||||||
options = vccOptions
|
args = clArgs,
|
||||||
)
|
options = vccOptions
|
||||||
quit vccProcess.waitForExit()
|
)
|
||||||
|
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
|
const
|
||||||
comSpecEnvKey = "ComSpec" ## Environment Variable that specifies the command-line application path in Windows
|
comSpecEnvKey = "ComSpec" ## Environment Variable that specifies the command-line application path in Windows
|
||||||
## Usually set to cmd.exe
|
## Usually set to cmd.exe
|
||||||
vcvarsallDefaultPath = "vcvarsall.bat"
|
|
||||||
|
|
||||||
type
|
type
|
||||||
VccArch* = enum ## The VCC compile target architectures
|
VccArch* = enum ## The VCC compile target architectures
|
||||||
|
|
@ -48,11 +47,10 @@ proc vccVarsAll*(path: string, arch: VccArch = vccarchUnspecified, platform_type
|
||||||
## verbose
|
## verbose
|
||||||
## Echo the command-line passed on to the system to load the VCC environment. Defaults to `false`.
|
## 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 == "":
|
if path == "":
|
||||||
vccvarsallpath = vcvarsallDefaultPath
|
return nil
|
||||||
|
|
||||||
|
let vccvarsallpath = path
|
||||||
var args: seq[string] = @[]
|
var args: seq[string] = @[]
|
||||||
|
|
||||||
let archStr: string = $arch
|
let archStr: string = $arch
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue