summary refs log tree commit diff stats
path: root/tools
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2018-11-15 11:32:31 -0800
committerAndreas Rumpf <rumpf_a@web.de>2018-11-15 20:32:31 +0100
commit2eb14bdd41933d3b1b624e48d7513172be1a1e7a (patch)
treeed43f563fe00170884a252027219ad1666b126b1 /tools
parent3fe8b4f69d3bf651e3b3dc0895e6767ce475007c (diff)
downloadNim-2eb14bdd41933d3b1b624e48d7513172be1a1e7a.tar.gz
add nimCompile to simplify koch; add nimfind to koch tools (#9723)
Diffstat (limited to 'tools')
-rw-r--r--tools/kochdocs.nim10
-rw-r--r--tools/nimfind.nims2
2 files changed, 12 insertions, 0 deletions
diff --git a/tools/kochdocs.nim b/tools/kochdocs.nim
index e54123332..94a445897 100644
--- a/tools/kochdocs.nim
+++ b/tools/kochdocs.nim
@@ -52,8 +52,18 @@ proc execCleanPath*(cmd: string,
   putEnv("PATH", prevPath)
 
 proc nimexec*(cmd: string) =
+  # Consider using `nimCompile` instead
   exec findNim() & " " & cmd
 
+proc nimCompile*(input: string, outputDir = "bin", mode = "c", options = "") =
+  # TODO: simplify pending https://github.com/nim-lang/Nim/issues/9513
+  var cmd = findNim() & " " & mode
+  let output = outputDir / input.splitFile.name.exe
+  cmd.add " -o:" & output
+  cmd.add " " & options
+  cmd.add " " & input
+  exec cmd
+
 const
   pdf = """
 doc/manual.rst
diff --git a/tools/nimfind.nims b/tools/nimfind.nims
new file mode 100644
index 000000000..3013c360d
--- /dev/null
+++ b/tools/nimfind.nims
@@ -0,0 +1,2 @@
+--define:nimfind
+--define:nimcore