forked from nimgl/nimgl
/
nimgl.nimble
47 lines (36 loc) · 1.1 KB
/
nimgl.nimble
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Package
version = "1.1.0"
author = "Leonardo Mariscal"
description = "Nim Game Library"
license = "MIT"
srcDir = "src"
skipDirs = @[".github", "tests"]
# Dependencies
requires "nim >= 1.0.0"
# Tasks
import
strutils
const
docDir = "docs"
proc nimExt(file: string): bool =
file[file.len - 4 ..< file.len] == ".nim"
proc genDocs(pathr: string, output: string) =
let path = pathr.replace(r"\", "/")
var src = path[path.rfind("/") + 1 .. path.len - 5]
echo "\n[info] generating " & src & ".nim"
if src == "nimgl":
src = "index"
exec("nim doc -d:vulkan -o:" & output & "/" & src & ".html" & " " & path)
proc walkRecursive(dir: string) =
for f in listFiles(dir):
if f.nimExt: genDocs(f, docDir)
for od in listDirs(dir):
walkRecursive(od)
task test, "Run files under examples dir":
exec("nimble install -y glm")
for file in listFiles("examples"):
if file[6] == 't' and file.nimExt:
echo "\n[info] testing " & file[6..<file.len]
exec("nim c -d:opengl_debug " & file)
task docs, "Generate documentation for all of the library":
walkRecursive(srcDir)