-
Notifications
You must be signed in to change notification settings - Fork 11
/
nimview.nimble
76 lines (67 loc) · 2.38 KB
/
nimview.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
version = "0.4.2"
author = "Marco Mengelkoch"
description = "Nim / Python / C library to run webview with HTML/JS as UI"
license = "MIT"
srcDir = "src"
import os, strutils
# Dependencies
# you may skip nimpy and webview when compiling with nim c -d:just_core
# Currently, Webview requires gcc and doesn't work with vcc or clang
requires "nim >= 1.4.8", "nimpy >= 0.1.1", "nake >= 1.9.0", "ws >= 0.4.4"
when defined(nimdistros):
import distros
# no foreignDep required for Windows
if detectOs(Ubuntu):
foreignDep "libwebkit2gtk-4.0-dev"
elif detectOs(CentOS) or detectOs(RedHat) or detectOs(Fedora):
foreignDep "webkitgtk4-devel"
if not detectOs(Windows):
echo "In case of trouble, you may need to install following dependencies:"
echo ""
echoForeignDeps()
echo ""
else:
echo "no nimdistros"
proc execSh(cmd: string) =
if detectOs(Windows):
exec "cmd /C " & cmd
else:
exec "bash -c '" & cmd & "'"
proc builDemoBinaries() =
let baseDir = thisDir()
cd baseDir / "examples/svelte_todo"
exec "nim c -f -d:release -d:useServer --out:" & baseDir & "/demo/httpTodo.exe src/App.nim"
exec "nim c -f -d:release --app:gui --out:" & baseDir & "/demo/appTodo.exe src/App.nim"
cd baseDir
proc builDemoJs() =
let baseDir = thisDir()
cd baseDir / "examples/svelte_todo"
execSh "npm install"
execSh "npm run build"
cd baseDir
task docs, "Generate doc":
exec "nim doc -o:docs/theindex.html src/nimview.nim "
exec "nim doc -o:docs/webviewRenderer.html src/nimview/webviewRenderer.nim"
exec "nim doc -o:docs/httpRenderer.html src/nimview/httpRenderer.nim"
exec "nim doc -o:docs/storage.html src/nimview/storage.nim"
exec "nim doc -o:docs/sharedTypes.html src/nimview/sharedTypes.nim"
exec "nim doc -o:docs/requestMap.html src/nimview/requestMap.nim"
exec "nim doc -o:docs/globals.html src/nimview/globals.nim"
# let cmd = "inliner -n --preserve-comments --iesafe --inlinemin docs/nimview_tmp.html > docs/nimview.html"
# execSh cmd
task demo, "Generate demo files":
builDemoJs()
builDemoBinaries()
task test, "Run tests":
builDemoBinaries()
let baseDir = thisDir()
cd baseDir / "examples/c_cpp"
let nake = system.findExe("nake")
exec nake & " clean"
exec nake & " test"
cd baseDir / "examples/python"
exec nake & " clean"
exec nake & " test"
cd baseDir
exec "testament pattern \"tests/*.nim\""
echo "All tests passed"