Fix source paths

This commit is contained in:
Ganesh Viswanathan 2019-01-16 21:28:04 -06:00
commit 0e3588d258
3 changed files with 17 additions and 7 deletions

View file

@ -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".}

View file

@ -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".}

View file

@ -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