diff options
author | Fredrik Høisæther Rasch <fredrik.h.rasch@uit.no> | 2017-03-21 12:14:58 +0100 |
---|---|---|
committer | Fredrik Høisæther Rasch <fredrik.h.rasch@uit.no> | 2017-03-21 12:18:32 +0100 |
commit | 24f07d9b71a5302047fa0183318d35fbc74222b4 (patch) | |
tree | 36a8e33cc2d741a2b004db7d23795d60b7335497 /tools/vccexe | |
parent | 513b0fed4da0a3bab46bc55b83e21575f41c2145 (diff) | |
download | Nim-24f07d9b71a5302047fa0183318d35fbc74222b4.tar.gz |
Exchanged debug compilation with verbose command-line argument
Diffstat (limited to 'tools/vccexe')
-rw-r--r-- | tools/vccexe/vccexe.nim | 15 | ||||
-rw-r--r-- | tools/vccexe/vcvarsall.nim | 14 |
2 files changed, 15 insertions, 14 deletions
diff --git a/tools/vccexe/vccexe.nim b/tools/vccexe/vccexe.nim index 6d0908c3b..4dec0db04 100644 --- a/tools/vccexe/vccexe.nim +++ b/tools/vccexe/vccexe.nim @@ -1,10 +1,5 @@ import strutils, strtabs, os, osproc, vcvarsall, vccdiscover -when defined(release): - let vccOptions = {poParentStreams} -else: - let vccOptions = {poEchoCmd, poParentStreams} - const vccversionPrefix = "--vccversion" vcvarsallPrefix = "--vcvarsall" @@ -12,6 +7,7 @@ const platformPrefix = "--platform" sdktypePrefix = "--sdktype" sdkversionPrefix = "--sdkversion" + verbosePrefix = "--verbose" vccversionSepIdx = vccversionPrefix.len vcvarsallSepIdx = vcvarsallPrefix.len @@ -65,6 +61,7 @@ when isMainModule: var platformArg: VccArch var sdkTypeArg: VccPlatformType var sdkVersionArg: string = nil + var verboseArg: bool = false var clArgs: seq[TaintedString] = @[] @@ -83,6 +80,8 @@ when isMainModule: sdkTypeArg = parseEnum[VccPlatformType](wargv.substr(sdktypeSepIdx + 1)) elif wargv.startsWith(sdkversionPrefix): # Check for sdkversion sdkVersionArg = wargv.substr(sdkversionSepIdx + 1) + elif wargv.startsWith(verbosePrefix): + verboseArg = true else: # Regular cl.exe argument -> store for final cl.exe invocation if (wargv.len == 2) and (wargv[1] == '?'): echo HelpText @@ -100,11 +99,15 @@ when isMainModule: if vcvarsallArg.len < 1 and vccversionArg.len < 1: vcvarsallArg = discoverVccVcVarsAllPath() - var vcvars = vccVarsAll(vcvarsallArg, platformArg, sdkTypeArg, sdkVersionArg) + var vcvars = vccVarsAll(vcvarsallArg, platformArg, sdkTypeArg, sdkVersionArg, verboseArg) if vcvars != nil: for vccEnvKey, vccEnvVal in vcvars: putEnv(vccEnvKey, vccEnvVal) + var vccOptions = {poParentStreams} + if verboseArg: + vccOptions.incl poEchoCmd + if commandArg.len < 1: commandArg = "cl.exe" let vccProcess = startProcess( diff --git a/tools/vccexe/vcvarsall.nim b/tools/vccexe/vcvarsall.nim index 798070799..dcd7ef868 100644 --- a/tools/vccexe/vcvarsall.nim +++ b/tools/vccexe/vcvarsall.nim @@ -27,7 +27,7 @@ type vccplatUWP = "uwp", vccplatOneCore = "onecore" -proc vccVarsAll*(path: string, arch: VccArch = vccarchUnspecified, platform_type: VccPlatformType = vccplatEmpty, sdk_version: string = nil): StringTableRef = +proc vccVarsAll*(path: string, arch: VccArch = vccarchUnspecified, platform_type: VccPlatformType = vccplatEmpty, sdk_version: string = nil, verbose: bool = false): StringTableRef = var vccvarsallpath = path # Assume that default executable is in current directory or in PATH if path == nil or path.len < 1: @@ -59,16 +59,14 @@ proc vccVarsAll*(path: string, arch: VccArch = vccarchUnspecified, platform_type comSpecCmd = "cmd" let comSpecExec = "\"$1\" /C \"$2 && SET\"" % [comSpecCmd, vcvarsExec] - when defined(release): - let comSpecOpts = {poEvalCommand, poDemon, poStdErrToStdOut} - else: - let comSpecOpts = {poEchoCmd, poEvalCommand, poDemon, poStdErrToStdOut} + var comSpecOpts = {poEvalCommand, poDemon, poStdErrToStdOut} + if verbose: + comSpecOpts.incl poEchoCmd let comSpecOut = execProcess(comSpecExec, options = comSpecOpts) result = newStringTable(modeCaseInsensitive) for line in comSpecOut.splitLines: let idx = line.find('=') if idx > 0: result[line[0..(idx - 1)]] = line[(idx + 1)..(line.len - 1)] - else: - when not defined(release) or defined(debug): - echo line + elif verbose: + echo line |