-
Notifications
You must be signed in to change notification settings - Fork 0
/
mvb.nimble
64 lines (48 loc) · 1.73 KB
/
mvb.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
# Package
version = "0.1.0"
author = "Jason Huggins"
description = "Minimum viable bindings for OpenCV"
license = "MIT"
srcDir = "src"
backend = "cpp"
# Dependencies
requires "nim >= 1.6.12"
requires "cppstl"
task i, "\t\tRun INim interpreter configured to use MVB":
exec "inim -d:--backend:cpp -d:'--passL:\"-lopencv_core -lopencv_imgcodecs -lopencv_highgui -lopencv_videoio\"'"
task demo, "\t\tRun the demo":
exec "nim cpp -r --hints:off examples/demo.nim"
task web_demo, "\tRun the web demo":
exec "nim cpp -r --hints:off examples/webdemo.nim"
task test, "\t\tRun the test suite":
exec "nim cpp -r --hints:off tests/test1.nim"
exec "nim cpp -r --hints:off tests/test2.nim"
task gendoc, "\t\tGenerate the documentation":
exec "nim doc --backend:cpp --git.url:https://github.com/tapsterbot/mvb-opencv --git.commit:v0.1.0 --outdir:docs src/mvb.nim"
import distros
when defined(nimdistros):
if detectOs(MacOSX):
# homebrew install opencv
foreignDep "opencv"
elif detectOs(Debian) or detectOs(Ubuntu):
# sudo apt install libopencv-dev
foreignDep "libopencv-dev"
elif detectOS(Windows):
# choco install opencv
foreignDep "opencv"
task install_opencv, "\tInstall OpenCV":
when defined(nimdistros):
if detectOs(MacOSX):
# Install opencv using homebrew
echo "Installing opencv..."
exec "brew install opencv"
# Fix paths
echo "Fixing paths..."
exec "ln -sf /usr/local/include/opencv4/opencv2 /usr/local/include/opencv2"
elif detectOs(Debian) or detectOs(Ubuntu):
exec "sudo apt install libopencv-dev"
else:
# TODO: Test on Windows
# TODO: Test on Raspberry Pi OS & Raspberry Pi Zero / Pi 4
discard
echo "Done."