-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rebol-OpenCV.nest
160 lines (147 loc) · 4.43 KB
/
Rebol-OpenCV.nest
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
;- .-.
;- /'v'\ SISKIN-Builder 3.9.0 project file
;- (/uOu\) https://github.com/Siskin-framework/Builder/
;-===="="=======================================================================
github: @opencv
compiler: clang
version: 4.9.0
;define: USE_TRACES
;- options common for all Rebol extensions ----------------------
#if Windows? [
define: TO_WINDOWS
define: _CRT_SECURE_NO_WARNINGS
]
#if macOS? [
define: TO_OSX
define: HAS_BOOL
]
#if Linux? [
define: TO_LINUX
compiler: gcc
]
define: ENDIAN_LITTLE
define: REB_EXT
target-x86: [
arch: x86
#if Windows? [ defines: [ TO_WIN32 _WIN32 ] ]
#if Linux? [ defines: [ TO_LINUX_X86 ] ]
]
target-x64: [
arch: x64
defines: [
_FILE_OFFSET_BITS=64
__LP64__ ; has long (integer) 64 bits
]
#if Windows? [ defines: [ TO_WIN32_X64 _WIN32 ] ]
#if Linux? [ defines: [ TO_LINUX_X64 ] ]
#if macOS? [ defines: [ TO_OSX_X64 ] flags: ["-arch x86_64"] ]
]
target-arm64: [
arch: arm64
;flags: ["-arch arm64"]
flags: "-target arm64-apple-darwin"
define: _FILE_OFFSET_BITS=64
define: __LP64__ ; has long (integer) 64 bits
define: __arm64__
define: TO_OSX_X64
]
;----------------------------------------------------------------
flags: [-O2 shared]
#if Posix? [
cflags: [-fPIC -pthread ]
;libraries: [%pthread]
]
#if posix? [
cppflag: "-std=c++11"
lflag: "-lstdc++"
include: %/usr/local/include/opencv4/
library: %/usr/local/lib/
library: %opencv_core
library: %opencv_features2d
library: %opencv_highgui
library: %opencv_imgcodecs
library: %opencv_imgproc
library: %opencv_videoio
library: %opencv_objdetect
]
#if Windows? [
compiler: clang
include: %build/include/
library: %opencv_core4100
library: %opencv_features2d4100
library: %opencv_highgui4100
library: %opencv_imgcodecs4100
library: %opencv_imgproc4100
library: %opencv_videoio4100
library: %opencv_objdetect4100
upx: on
]
make-extension: [
files: [
%src/opencv-rebol-extension.c
%src/opencv-commands.cpp
%src/opencv-commands-table.c
]
;- generate main extension header --------------------------------
do %src/opencv-rebol-extension.r3
]
eggs: only [
#if (find [Linux OpenBSD FreeBSD NetBSD DragonflyBSD] system/platform) [
"Build OpenCV libraries (cmake)" [
;@@ https://docs.opencv.org/4.x/d7/d9f/tutorial_linux_install.html
name: %opencv-libraries
cmd %tmp/linux/ "cmake -G ^"Unix Makefiles^" ../../opencv/ -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=ON -DBUILD_EXAMPLES:BOOL=OFF -DINSTALL_CREATE_DISTRIB=OFF"
cmd %tmp/linux/ "sudo make install -j8"
]
]
#if Windows? [
"Build OpenCV libraries (cmake) x86" [
name: %opencv-libraries-x86
cmd %tmp/x86/ "cmake ../../opencv/ -A Win32 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=..\..\build\ -DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=ON -DBUILD_EXAMPLES:BOOL=OFF -DINSTALL_CREATE_DISTRIB=OFF"
cmd %tmp/x86/ "cmake --build . --config release -j 8"
cmd %tmp/x86/ "cmake --build . --target install --config release"
]
"Build OpenCV libraries (cmake) x64" [
name: %opencv-libraries-x64
cmd %tmp/x64/ "cmake ../../opencv/ -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=..\..\build\ -DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=ON -DBUILD_EXAMPLES:BOOL=OFF -DINSTALL_CREATE_DISTRIB=OFF"
cmd %tmp/x64/ "cmake --build . --config release -j 8"
cmd %tmp/x64/ "cmake --build . --target install --config release"
]
"Rebol openCV extension: windows_x86" [
name: %opencv-windows-x86.rebx
library: %build/x86/vc17/lib/
:make-extension
:target-x86
]
"Rebol openCV extension: windows_x64" [
name: %opencv-windows-x64.rebx
library: %build/x64/vc17/lib/
:make-extension
:target-x64
]
]
#if macOS? [
"Rebol openCV extension: macos_x64" [
name: %opencv-macos-x64
:make-extension
:target-x64
]
"Rebol openCV extension: macos_arm64" [
name: %opencv-macos-arm64
:make-extension
:target-arm64
]
]
#if Linux? [
"Rebol openCV extension: linux_x86" [
name: %opencv-linux-x86
:make-extension
:target-x86
]
"Rebol openCV extension: linux_x64" [
name: %opencv-linux-x64
:make-extension
:target-x64
]
]
]