Use nimFile

This commit is contained in:
Joey Yakimowich-Payne 2020-09-09 20:26:24 -06:00
commit e8d5379897
3 changed files with 9 additions and 5 deletions

1
.gitignore vendored
View file

@ -9,6 +9,7 @@ build
nimcache/
generated/
build/
examples/demo
demo.exe

View file

@ -12,8 +12,8 @@ requires "nim >= 1.0.6",
"https://github.com/jyapayne/nimterop#367ec05",
"opengl >= 1.2.6",
"sdl2#head",
"https://github.com/jyapayne/nim-glew#c6a3e51",
"https://github.com/jyapayne/nim-glfw#8414225"
"https://github.com/jyapayne/nim-glew#472f904",
"https://github.com/jyapayne/nim-glfw#41b7a74"
import os

View file

@ -1,3 +1,4 @@
import macros
import os
import strutils
import glew
@ -11,6 +12,8 @@ import nimterop/[cimport, build]
const
baseDir = currentSourcePath.parentDir().parentDir().parentDir()
srcDir = baseDir/"build"/"nanovg"
currentPath = getProjectPath().parentDir().sanitizePath
generatedPath = (currentPath / "generated" / "nanovg").replace("\\", "/")
symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim"
defs = """
@ -121,6 +124,6 @@ cPluginPath(symbolPluginPath)
# Finally import wrapped header file. Recurse if #include files should also
# be wrapped. Set dynlib if binding to dynamic library.
cImport(srcDir/"src"/"nanovg.h", flags = "-f=ast2 -H")
cImport(srcDir/"src"/"nanovg_gl.h", flags = "-f=ast2 -H")
cImport(srcDir/"src"/"nanovg_gl_utils.h", flags = "-f=ast2 -H")
cImport(srcDir/"src"/"nanovg.h", flags = "-f=ast2 -H", nimFile = generatedPath / "nanovg.nim")
cImport(srcDir/"src"/"nanovg_gl.h", flags = "-f=ast2 -H", nimFile = generatedPath / "nanovg_gl.nim")
cImport(srcDir/"src"/"nanovg_gl_utils.h", flags = "-f=ast2 -H", nimFile = generatedPath / "nanovg_gl_utils.nim")