summary refs log tree commit diff stats
path: root/tools/vccexe.nim
diff options
context:
space:
mode:
authorFredrik Høisæther Rasch <fredrik.rasch@gmail.com>2016-10-01 01:56:08 +0200
committerFredrik Høisæther Rasch <fredrik.rasch@gmail.com>2016-10-01 01:56:08 +0200
commitc93ed4858013d43d560d8deba7916b5c798e56eb (patch)
tree5002983ecaa61fb2de70f3a63381719e4c8ac53d /tools/vccexe.nim
parentabf4e204c2f1a8a6915a8d32c970b5ce64f58e10 (diff)
downloadNim-c93ed4858013d43d560d8deba7916b5c798e56eb.tar.gz
Add VCC wrappers
Enables automatic loading of Visual Studio C/C++ Build Tools
Diffstat (limited to 'tools/vccexe.nim')
-rw-r--r--tools/vccexe.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/vccexe.nim b/tools/vccexe.nim
new file mode 100644
index 000000000..a62def77c
--- /dev/null
+++ b/tools/vccexe.nim
@@ -0,0 +1,25 @@
+import strtabs, os, osproc, vccenv
+
+when defined(release):
+  let vccOptions = { poParentStreams }
+else:
+  let vccOptions = { poEchoCmd, poParentStreams }
+
+when isMainModule:
+  var vccEnvStrTab: StringTableRef = nil
+  when defined(i386):
+    vccEnvStrTab = getVccEnv "x86"
+  when defined(amd64):
+    vccEnvStrTab = getVccEnv "amd64"
+  when defined(arm):
+    vccEnvStrTab = getVccEnv "arm"
+  if vccEnvStrTab != nil:
+    for vccEnvKey, vccEnvVal in vccEnvStrTab:
+      putEnv(vccEnvKey, vccEnvVal)
+  let vccProcess = startProcess(
+      "cl".addFileExt(ExeExt), 
+      args = commandLineParams(),
+      options = vccOptions
+    )
+  quit vccProcess.waitForExit()
+    
\ No newline at end of file