Fix for absolute paths in includes and headers
This commit is contained in:
parent
a717b9d140
commit
60d94e9114
1 changed files with 12 additions and 6 deletions
18
nimgen.nim
18
nimgen.nim
|
|
@ -493,10 +493,13 @@ 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:
|
||||||
passC &= (
|
if inc.isAbsolute():
|
||||||
"""{.passC: "-I\"" & currentSourcePath().splitPath().head & "$#\"".}""" %
|
passC &= ("""{.passC: "-I\"$#\"".}""" % [inc]) & "\n"
|
||||||
inc.relativePath()
|
else:
|
||||||
) & "\n"
|
passC &= (
|
||||||
|
"""{.passC: "-I\"" & currentSourcePath().splitPath().head & "$#\"".}""" %
|
||||||
|
inc.relativePath()
|
||||||
|
) & "\n"
|
||||||
|
|
||||||
for prag in c2nimConfig.pragma:
|
for prag in c2nimConfig.pragma:
|
||||||
outpragma &= "{." & prag & ".}\n"
|
outpragma &= "{." & prag & ".}\n"
|
||||||
|
|
@ -532,8 +535,11 @@ proc c2nim(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
|
||||||
if outlib != "":
|
if outlib != "":
|
||||||
extflags &= " --dynlib:dynlib$#" % fname
|
extflags &= " --dynlib:dynlib$#" % fname
|
||||||
else:
|
else:
|
||||||
passC &= "const header$# = currentSourcePath().splitPath().head & \"$#\"\n" %
|
if file.isAbsolute():
|
||||||
[fname, file.relativePath()]
|
passC &= "const header$# = \"$#\"\n" % [fname, file]
|
||||||
|
else:
|
||||||
|
passC &= "const header$# = currentSourcePath().splitPath().head & \"$#\"\n" %
|
||||||
|
[fname, file.relativePath()]
|
||||||
extflags = "--header:header$#" % fname
|
extflags = "--header:header$#" % fname
|
||||||
|
|
||||||
# Run c2nim on generated file
|
# Run c2nim on generated file
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue