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/ nimcache/
generated/
build/ build/
examples/demo examples/demo
demo.exe demo.exe

View file

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

View file

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