Skip to content

Commit

Permalink
Add support for passing syspaths as defines
Browse files Browse the repository at this point in the history
  • Loading branch information
PMunch committed Jan 7, 2023
1 parent 66f1c89 commit 7dc441b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/futhark.nim
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const
"when", "while",
"xor",
"yield"]
syspaths {.strdefine.} = ""

template strCmp(node, value: untyped): untyped = node.kind in Stringable and node.strVal == value

Expand Down Expand Up @@ -472,6 +473,8 @@ macro importc*(imports: varargs[untyped]): untyped =
defs = quote do: `defs` & ("#include " & `toImport` & "\n")
files.add toImport
else: error "Unknown argument passed to importc: " & $node.repr
for path in syspaths.split(":"):
cargs.add superQuote do: "-I" & absolutePath(`path`, getProjectPath())
result.add quote do: importcImpl(`defs`, `cargs`, `files`, `importDirs`, `renames`, `retypes`, RenameCallback(`renameCallback`))

macro importcImpl*(defs: static[string], compilerArguments, files: static[openArray[string]], importDirs: static[openArray[string]], renames, retypes: static[openArray[FromTo]], renameCallback: static[RenameCallback]): untyped =
Expand Down

0 comments on commit 7dc441b

Please sign in to comment.