Skip to content

Commit

Permalink
Improve clang detection based on #48 for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-j authored and PMunch committed Jan 7, 2023
1 parent 2c42965 commit a73fdfc
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions tests/config.nims
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
switch("define", "opirRebuild")
switch("define", "futharkRebuild")

import strutils

proc getClangPath(): string =
var sysPaths: seq[string]
for line in staticExec("clang -x c -v -E /dev/null").split("\n"):
if line.startsWith(" /"):
sysPaths.add(line.substr(1))
break
if sysPaths.len > 0:
sysPaths[0]
proc getClangIncludePath(): string =
const inclDir = staticExec("clang -print-resource-dir") & "/include"
when dirExists(inclDir):
inclDir
else:
{.warning: "futhark: clang include path not found".}
""

var clangPath = getClangPath()

if clangPath == "":
echo "clang include path not found"

switch("define", "sysPaths:" & clangPath)
const clangIncludePath = getClangIncludePath()

switch("define", "sysPaths:" & clangIncludePath)

0 comments on commit a73fdfc

Please sign in to comment.