-
Notifications
You must be signed in to change notification settings - Fork 3
/
bld_ocv64.sh
71 lines (68 loc) · 1.73 KB
/
bld_ocv64.sh
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
#!/bin/bash
if [ $MSYSTEM != "MINGW64" ]; then
echo "You MUST launch MSYS2 using mingw64_shell.bat"
echo "OR set the PROCESS environment variable: MSYSTEM , to 'MINGW64', prior launching mintty.exe"
exit
fi
if [ ! -d ~/opencv ]; then
git clone --recursive https://github.com/Itseez/opencv.git
else
cd opencv
git pull
fi
cd ~
if [ ! -d ~/ocvcontrib ]; then
git clone --recursive https://github.com/Itseez/opencv_contrib.git ocvcontrib
else
cd ocvcontrib
git pull
fi
cd ~
if [ ! -d ~/ocv64 ]; then
mkdir ~/ocv64
fi
cd ~/ocv64
if [ -f Makefile ]; then
make clean
fi
cd ~/opencv
cp ~/patches/mingw-w64-opencv/*.patch ./
patch -Np1 -i "mingw-w64-cmake.patch"
patch -Np1 -i "solve_deg3-underflow.patch"
#patch -Np1 -i "issue-4107.patch"
#4107 should have been fixed in master branch
patch -Np1 -i "remove-bindings-generation-DetectionBasedTracker.patch"
patch -Np1 -i "generate-proper-pkg-config-file.patch"
patch -Np1 -i "opencv-support-python-3.5.patch"
cd ~/ocv64
THREAD=$(nproc)
THREAD=$((THREAD<2?1:THREAD-1))
PATH=${PATH}:${CUDA_PATH}
cmake \
-G"MSYS Makefiles" \
-DCMAKE_INSTALL_PREFIX="$(cygpath -wa /)mingw64" \
-DCMAKE_BUILD_TYPE=Release \
-DPKG_CONFIG_WITHOUT_PREFIX=ON \
-DBUILD_SHARED_LIBS=ON \
-DWITH_CUDA=OFF \
-DWITH_VTK=OFF \
-DWITH_GTK=OFF \
-DWITH_OPENCL=ON \
-DWITH_OPENGL=ON \
-DCMAKE_SKIP_RPATH=ON \
-DENABLE_PRECOMPILED_HEADERS=OFF \
-DENABLE_FAST_MATH=ON \
-DENABLE_SSE3=ON \
-DENABLE_SSSE3=ON \
-DENABLE_SSE41=ON \
-DENABLE_SSE42=ON \
-DCPACK_BINARY_7Z=ON \
-DCPACK_BINARY_NSIS=OFF \
-DOPENCV_EXTRA_MODULES_PATH=../ocvcontrib/modules \
-DBUILD_opencv_text=OFF \
-Wno-dev \
~/opencv \
make -j$THREAD && make package
if [ $# -gt 0 ] && [ "--enable-make-install" = "$1" ]; then
make install
fi