Fix miscellaneous windows issues with building

This commit is contained in:
Joey Yakimowich-Payne 2018-07-14 22:04:03 +09:00
commit 0473e79c0b
4 changed files with 10 additions and 5 deletions

View file

@ -38,7 +38,7 @@ proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
for inc in gIncludes:
if inc.isAbsolute():
passC &= ("""{.passC: "-I\"$#\"".}""" % [inc]) & "\n"
passC &= ("""{.passC: "-I\"$#\"".}""" % [inc.sanitizePath()]) & "\n"
else:
passC &= (
"""{.passC: "-I\"" & currentSourcePath().splitPath().head & "$#\"".}""" %
@ -85,11 +85,10 @@ proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
passC &= "const header$# = currentSourcePath().splitPath().head & \"$#\"\n" %
[fname, file.relativePath()]
extflags = "--header:header$#" % fname
# Run c2nim on generated file
var cmd = "c2nim $# $# --out:$# $#" % [c2nimConfig.flags, extflags, outfile, cfile]
when defined(windows):
cmd = "cmd /c " & cmd
cmd = "cmd /c " & cmd.quoteShell
discard execProc(cmd)
if c2nimConfig.preprocess or c2nimConfig.ctags:

View file

@ -2,6 +2,9 @@ import os, osproc, regex, ropes, streams, strutils
import globals
proc sanitizePath*(path: string): string =
path.multiReplace([("\\", "/"), ("//", "/")])
proc execProc*(cmd: string): string =
result = ""
var
@ -106,7 +109,7 @@ proc runPreprocess*(file, ppflags, flags: string, inline: bool): string =
cmd = "$# -E $# $#" % [pproc, ppflags, file]
for inc in gIncludes:
cmd &= " -I " & inc
cmd &= " -I " & inc.quoteShell
# Run preprocessor
var data = execProc(cmd)

View file

@ -20,7 +20,7 @@ proc addEnv*(str: string): string =
discard
# if there are still format args, print a warning
if newStr.contains("${"):
if newStr.contains("$") and not newStr.contains("$replace("):
echo "WARNING: \"", newStr, "\" still contains an uninterpolated value!"
return newStr

View file

@ -196,6 +196,9 @@ proc runCfg*(cfg: string) =
# Reset on a per project basis
gCCompiler = getEnv(cCompilerEnv, defaultCCompiler)
gCppCompiler = gCppCompiler.quoteShell
gCCompiler = gCCompiler.quoteShell
if gConfig["n.global"].hasKey("filter"):
gFilter = gConfig["n.global"]["filter"]
if gConfig["n.global"].hasKey("quotes"):