Improve compile
This commit is contained in:
parent
1e26d3e6eb
commit
7e21b2799e
2 changed files with 11 additions and 15 deletions
|
|
@ -100,11 +100,7 @@ proc c2nim*(fl, outfile: string, c2nimConfig: c2nimConfigObj) =
|
||||||
|
|
||||||
# Include {.compile.} directives
|
# Include {.compile.} directives
|
||||||
for cpl in c2nimConfig.compile:
|
for cpl in c2nimConfig.compile:
|
||||||
let fcpl = search(cpl)
|
prepend(outfile, compile(cpl, c2nimConfig.flags))
|
||||||
if getFileInfo(fcpl).kind == pcFile:
|
|
||||||
prepend(outfile, compile(c2nimConfig.flags, file=fcpl))
|
|
||||||
else:
|
|
||||||
prepend(outfile, compile(c2nimConfig.flags, dir=fcpl))
|
|
||||||
|
|
||||||
# Add any pragmas
|
# Add any pragmas
|
||||||
if outpragma != "":
|
if outpragma != "":
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ proc addEnv*(str: string): string =
|
||||||
|
|
||||||
return newStr
|
return newStr
|
||||||
|
|
||||||
proc compile*(flags: string, dir="", file=""): string =
|
proc compile*(cpl, flags: string): string =
|
||||||
var data = ""
|
var data = ""
|
||||||
|
|
||||||
proc fcompile(file: string): string =
|
proc fcompile(file: string): string =
|
||||||
|
|
@ -27,18 +27,18 @@ proc compile*(flags: string, dir="", file=""): string =
|
||||||
for f in walkFiles(dir):
|
for f in walkFiles(dir):
|
||||||
data &= fcompile(f) & "\n"
|
data &= fcompile(f) & "\n"
|
||||||
|
|
||||||
if dir != "":
|
if cpl.contains("*") or cpl.contains("?"):
|
||||||
if dir.contains("*") or dir.contains("?"):
|
dcompile(cpl)
|
||||||
dcompile(dir)
|
else:
|
||||||
elif dirExists(dir):
|
let fcpl = search(cpl)
|
||||||
|
if getFileInfo(fcpl).kind == pcFile:
|
||||||
|
data &= fcompile(fcpl) & "\n"
|
||||||
|
elif getFileInfo(fcpl).kind == pcDir:
|
||||||
if flags.contains("cpp"):
|
if flags.contains("cpp"):
|
||||||
for i in @["*.C", "*.cpp", "*.c++", "*.cc", "*.cxx"]:
|
for i in @["*.C", "*.cpp", "*.c++", "*.cc", "*.cxx"]:
|
||||||
dcompile(dir / i)
|
dcompile(fcpl / i)
|
||||||
else:
|
else:
|
||||||
dcompile(dir / "*.c")
|
dcompile(fcpl / "*.c")
|
||||||
|
|
||||||
if file != "" and fileExists(file):
|
|
||||||
data &= fcompile(file) & "\n"
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue