diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-12-16 14:59:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-16 07:59:18 +0100 |
commit | 8a3b76b28733a87e5cffa3f4b7b99d76f13ee2ba (patch) | |
tree | 372f3b20585d9d3198bde541137a918ccb03c891 /tools/niminst/niminst.nim | |
parent | 644318ad9cbf079f33d8d7b6c5ead4a4429adb3e (diff) | |
download | Nim-8a3b76b28733a87e5cffa3f4b7b99d76f13ee2ba.tar.gz |
csource building prefers `bin/nim` (#21115)
Diffstat (limited to 'tools/niminst/niminst.nim')
-rw-r--r-- | tools/niminst/niminst.nim | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim index cd2e5a481..bc763a56f 100644 --- a/tools/niminst/niminst.nim +++ b/tools/niminst/niminst.nim @@ -515,6 +515,17 @@ template gatherFiles(fun, libpath, outDir) = # commenting out for now, see discussion in https://github.com/nim-lang/Nim/pull/13413 # copySrc(libpath / "lib/wrappers/linenoise/linenoise.h") +proc exe(f: string): string = + result = addFileExt(f, ExeExt) + when defined(windows): + result = result.replace('/','\\') + +proc findNim(): string = + let nim = "nim".exe + result = quoteShell("bin" / nim) + if not fileExists(result): + result = "nim" + proc srcdist(c: var ConfigData) = let cCodeDir = getOutputDir(c) / "c_code" if not dirExists(cCodeDir): createDir(cCodeDir) @@ -533,10 +544,10 @@ proc srcdist(c: var ConfigData) = var dir = getOutputDir(c) / buildDir(osA, cpuA) if dirExists(dir): removeDir(dir) createDir(dir) - var cmd = ("nim compile -f --symbolfiles:off --compileonly " & + var cmd = ("$# compile -f --symbolfiles:off --compileonly " & "--gen_mapping --cc:gcc --skipUserCfg" & " --os:$# --cpu:$# $# $#") % - [osname, cpuname, c.nimArgs, c.mainfile] + [findNim(), osname, cpuname, c.nimArgs, c.mainfile] echo(cmd) if execShellCmd(cmd) != 0: quit("Error: call to nim compiler failed") |