-
Notifications
You must be signed in to change notification settings - Fork 20
/
opir.nims
23 lines (21 loc) · 904 Bytes
/
opir.nims
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import std/[os, strutils]
when defined(windows):
# Default LLVM install library path on Windows
const libpath = getEnv("ProgramFiles") / "LLVM" / "lib"
if libpath.dirExists():
switch("passL", "-L" & quoteShell(libpath))
elif defined(macosx):
# Default libclang path on macOS
const libpath = staticExec("xcode-select -p").strip() / "usr" / "lib"
if libpath.dirExists():
switch("passL", "-L" & quoteShell(libpath))
switch("passL", "-Wl,-rpath " & quoteShell(libpath.quoteShell))
elif defined(linux):
const libpath = staticExec("clang -print-file-name=../../libclang.so").strip().parentDir()
if fileExists(libpath / "libclang.so"):
switch("passL", "-L" & libpath)
else:
const libpath2 = staticExec("clang -print-file-name=libclang.so").strip().parentDir()
if fileExists(libpath2 / "libclang.so"):
switch("passL", "-L" & libpath2)
switch("passL", "-lclang")