mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
csource building prefers bin/nim (#21115)
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user