diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2019-01-16 21:28:04 -0600 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2019-01-16 21:28:04 -0600 |
| commit | 0e3588d258ed5a2e8eb5e2535fc33056fd43ab53 (patch) | |
| tree | 48e181b531f5060f73018f5695f19903db9eb753 | |
| parent | d2bd1f7dad18524d74429566bbe73e3d3adeb232 (diff) | |
| download | nimterop-0e3588d258ed5a2e8eb5e2535fc33056fd43ab53.tar.gz nimterop-0e3588d258ed5a2e8eb5e2535fc33056fd43ab53.zip | |
Fix source paths
| -rw-r--r-- | nimterop/treesitter/c.nim | 5 | ||||
| -rw-r--r-- | nimterop/treesitter/cpp.nim | 5 | ||||
| -rw-r--r-- | nimterop/treesitter/runtime.nim | 14 |
3 files changed, 17 insertions, 7 deletions
diff --git a/nimterop/treesitter/c.nim b/nimterop/treesitter/c.nim index a60d072..9310f97 100644 --- a/nimterop/treesitter/c.nim +++ b/nimterop/treesitter/c.nim @@ -1,5 +1,8 @@ +import strutils + import "."/runtime {.compile: ("../../inc/treesitter_c/src/parser.c", "parserc.o").} -proc treeSitterC*(): ptr TSLanguage {.importc: "tree_sitter_c", header: "inc/treesitter_c/src/parser.h".} +const sourcePath = currentSourcePath().split({'\\', '/'})[0..^4].join("/") +proc treeSitterC*(): ptr TSLanguage {.importc: "tree_sitter_c", header: sourcePath & "/inc/treesitter_c/src/parser.h".} diff --git a/nimterop/treesitter/cpp.nim b/nimterop/treesitter/cpp.nim index 9509139..794d6c0 100644 --- a/nimterop/treesitter/cpp.nim +++ b/nimterop/treesitter/cpp.nim @@ -1,6 +1,9 @@ +import strutils + import "."/runtime {.compile: ("../../inc/treesitter_cpp/src/parser.c", "parsercpp.o").} {.compile: ("../../inc/treesitter_cpp/src/scanner.cc", "scannercpp.o").} -proc treeSitterCpp*(): ptr TSLanguage {.importc: "tree_sitter_cpp", header: "inc/treesitter_cpp/src/parser.h".} +const sourcePath = currentSourcePath().split({'\\', '/'})[0..^4].join("/") & "/inc/treesitter_cpp/src/" +proc treeSitterCpp*(): ptr TSLanguage {.importc: "tree_sitter_cpp", header: sourcePath & "parser.h".} diff --git a/nimterop/treesitter/runtime.nim b/nimterop/treesitter/runtime.nim index 34ce237..6650aaf 100644 --- a/nimterop/treesitter/runtime.nim +++ b/nimterop/treesitter/runtime.nim @@ -1,10 +1,14 @@ {.experimental: "codeReordering".} +import strutils + +const sourcePath = currentSourcePath().split({'\\', '/'})[0..^4].join("/") & "/inc/treesitter" + {.passC: "-std=c11 -DUTF8PROC_STATIC".} -{.passC: "-Iinc/treesitter/include".} -{.passC: "-Iinc/treesitter/src".} -{.passC: "-Iinc/utf8proc".} -{.compile: "../../inc/treesitter/src/runtime/runtime.c".} +{.passC: "-I$1/include" % sourcePath.} +{.passC: "-I$1/src" % sourcePath.} +{.passC: "-I$1/../utf8proc" % sourcePath.} +{.compile: sourcePath & "/src/runtime/runtime.c".} type TSInputEncoding* = distinct int converter enumToInt(en: TSInputEncoding): int {.used.} = en.int @@ -16,7 +20,7 @@ type TSLogType* = distinct int converter enumToInt(en: TSLogType): int {.used.} = en.int const - headerruntime = "inc/treesitter/include/tree_sitter/runtime.h" + headerruntime = sourcePath & "/include/tree_sitter/runtime.h" TREE_SITTER_LANGUAGE_VERSION* = 9 TSInputEncodingUTF8* = 0.TSInputEncoding TSInputEncodingUTF16* = 1.TSInputEncoding |
