From 747e5a6b64ef783479bda03b1505e9fdfea6c78a Mon Sep 17 00:00:00 2001 From: Fredrik Høisæther Rasch Date: Tue, 21 Mar 2017 01:24:45 +0100 Subject: vccenv module for vcc auto-discovery Only works for VCC Installations with Visual Studio 2015 and below --- tools/vccexe/vccenv.nim | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tools/vccexe/vccenv.nim (limited to 'tools/vccexe') 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) -- cgit 1.4.1-2-gfad0