-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.sh
executable file
·59 lines (54 loc) · 1.5 KB
/
build.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
#!/bin/bash -e
# Function that executes the clone command given as $1 iff repo does not exist yet. Otherwise pulls.
# Only works if repository path ends with '.git'
# Example: git_clone "git clone --branch 3.4.1 --depth=1 https://github.com/opencv/opencv.git"
function git_clone(){
repo_dir=`basename "$1" .git`
git -C "$repo_dir" pull 2> /dev/null || eval "$1"
}
# Ensure that current directory is root of project
cd $(dirname `realpath $0`)
# Enable colors
source external/bash_colors/bash_colors.sh
function highlight(){
clr_magentab clr_bold clr_white "$1"
}
cd external
highlight "Building opencv..."
git_clone "git clone --depth=1 https://github.com/opencv/opencv.git"
cd opencv
mkdir -p build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="`pwd`/../install" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_JAVA=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_PROTOBUF=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_opencv_apps=OFF \
-DBUILD_opencv_calib3d=OFF \
-DBUILD_opencv_dnn=OFF \
-DBUILD_opencv_gapi=OFF \
-DBUILD_opencv_java=OFF \
-DBUILD_opencv_java_bindings_generator=OFF \
-DBUILD_opencv_ml=OFF \
-DBUILD_opencv_objdetect=OFF \
-DBUILD_opencv_python2=OFF \
-DBUILD_opencv_python3=OFF \
-DBUILD_opencv_python_bindings_generator=OFF \
-DBUILD_opencv_python_tests=OFF \
-DBUILD_opencv_stitching=OFF \
-DWITH_1394=OFF \
-DWITH_PROTOBUF=OFF \
-DWITH_VTK=OFF \
..
make -j8
cd ../../..
mkdir build
cd build
cmake \
-DOpenCV_DIR="$(pwd)/../external/opencv/build" \
..
make -j8