Fix for absolute paths in includes and headers

This commit is contained in:
Ganesh Viswanathan 2018-07-08 19:11:41 -05:00
commit 60d94e9114

View file

@ -493,6 +493,9 @@ proc c2nim(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
passC = "import ospaths, strutils\n" passC = "import ospaths, strutils\n"
for inc in gIncludes: for inc in gIncludes:
if inc.isAbsolute():
passC &= ("""{.passC: "-I\"$#\"".}""" % [inc]) & "\n"
else:
passC &= ( passC &= (
"""{.passC: "-I\"" & currentSourcePath().splitPath().head & "$#\"".}""" % """{.passC: "-I\"" & currentSourcePath().splitPath().head & "$#\"".}""" %
inc.relativePath() inc.relativePath()
@ -531,6 +534,9 @@ proc c2nim(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
if outlib != "": if outlib != "":
extflags &= " --dynlib:dynlib$#" % fname extflags &= " --dynlib:dynlib$#" % fname
else:
if file.isAbsolute():
passC &= "const header$# = \"$#\"\n" % [fname, file]
else: else:
passC &= "const header$# = currentSourcePath().splitPath().head & \"$#\"\n" % passC &= "const header$# = currentSourcePath().splitPath().head & \"$#\"\n" %
[fname, file.relativePath()] [fname, file.relativePath()]