diff options
author | Fredrik Høisæther Rasch <fredrik.rasch@gmail.com> | 2017-03-21 01:24:45 +0100 |
---|---|---|
committer | Fredrik Høisæther Rasch <fredrik.h.rasch@uit.no> | 2017-03-21 12:18:31 +0100 |
commit | 747e5a6b64ef783479bda03b1505e9fdfea6c78a (patch) | |
tree | ea7616bd9a08b7ec5db09405fda216fb610ebd19 /tools/vccexe | |
parent | 289f72ad67faf273b63d49c0983072f43960e370 (diff) | |
download | Nim-747e5a6b64ef783479bda03b1505e9fdfea6c78a.tar.gz |
vccenv module for vcc auto-discovery
Only works for VCC Installations with Visual Studio 2015 and below
Diffstat (limited to 'tools/vccexe')
-rw-r--r-- | tools/vccexe/vccenv.nim | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/vccexe/vccenv.nim b/tools/vccexe/vccenv.nim new file mode 100644 index 000000000..addf77e38 --- /dev/null +++ b/tools/vccexe/vccenv.nim @@ -0,0 +1,25 @@ +import os + +type + VccEnvVersion* = enum + vsUndefined = (0, ""), + vs90 = (90, "VS90COMNTOOLS"), # Visual Studio 2008 + vs100 = (100, "VS100COMNTOOLS"), # Visual Studio 2010 + vs110 = (110, "VS110COMNTOOLS"), # Visual Studio 2012 + vs120 = (120, "VS120COMNTOOLS"), # Visual Studio 2013 + vs140 = (140, "VS140COMNTOOLS") # Visual Studio 2015 + +const + vcvarsallRelativePath = joinPath("..", "..", "VC", "vcvarsall") + +proc vccEnvVcVarsAllPath*(version: VccEnvVersion = vsUndefined): string = + if version == vsUndefined: + for tryVersion in [vs140, vs120, vs110, vs100, vs90]: + let tryPath = vccEnvVcVarsAllPath(tryVersion) + if tryPath.len > 0: + result = tryPath + else: # Specific version requested + let key = $version + let val = getEnv key + if val.len > 0: + result = expandFilename(val & vcvarsallRelativePath) |