-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuzDep.sh
executable file
·75 lines (68 loc) · 2.58 KB
/
uzDep.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
72
73
74
75
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
UNAME="$(uname)"
glfwVersion=$(pkg-config libglfw --modversion )
if [[ -z "$glfwVersion" ]]; then
# Unzip the dependency
if [ ! -d "$DIR/glfw-2.7.9" ]; then
unzip "$DIR/glfw-2.7.9.zip" -d $DIR
fi
# Build the dependency
if [ "$UNAME" = "Darwin" ]; then
make -C glfw-2.7.9 cocoa
sudo make -C glfw-2.7.9 cocoa-install
fi
if [ "$UNAME" = "Linux" ]; then
make -C glfw-2.7.9 x11
sudo make -C glfw-2.7.9 x11-install
fi
fi
glmVersion=$(pkg-config glm --modversion )
if [[ -z "$glmVersion" ]]; then
glmVersion=$(whereis glm )
fi
if [[ -z "$glmVersion" ]]; then
# fetch the dependency
if [ ! -f "$DIR/glm-0.9.9.5.zip" ]; then
wget "https://github.com/g-truc/glm/releases/download/0.9.9.5/glm-0.9.9.5.zip"
fi
# Unzip the dependency
if [ ! -d "$DIR/glm" ]; then
unzip "$DIR/glm-0.9.9.5.zip" -d $DIR
mkdir "$DIR/glm/release"
fi
# Build the dependency
pushd "$DIR/glm/release"
cmake ../
make all -j$(nproc)
sudo make install
popd
fi
# building opencv2 from scratch on mac takes too much
# time,lets only build it for linux if we have too.
if [ "$UNAME" = "Linux" ]; then
opencvVersion=$(pkg-config opencv --modversion )
badversion="3.0.0"
if [ "$(printf '%s\n' "$badversion" "$opencvVersion" | sort -V | head -n1)" = "$badversion" ]; then
echo "version of Opencv installed: ($opencvVersion) is too new, unistalling!"
sudo apt-get remove libopencv-dev
opencvVersion=$(pkg-config opencv --modversion )
fi
if [[ -z "$opencvVersion" ]]; then
opencv="opencv-2.4.13.5"
# fetch the dependency
if [ ! -f "$DIR/$opencv.zip" ]; then
wget "https://github.com/opencv/opencv/archive/2.4.13.5.zip" -O "$opencv.zip"
fi
# Unzip the dependency
if [ ! -d "$DIR/$opencv" ]; then
unzip "$opencv.zip" -d $DIR
mkdir "$DIR/$opencv/release"
fi
# Build the dependency
pushd "$DIR/$opencv/release"
cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=/usr/bin/g++ CMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DWITH_FFMPEG=OFF -DWITH_JPEG=OFF -DWITH_PNG=OFF -DWITH_TIFF=OFF -DWITH_TBB=ON -DWITH_OPENGL=ON -DINSTALL_TO_MANGLED_PATHS=ON -DINSTALL_CREATE_DISTRIB=ON -DENABLE_FAST_MATH=ON -DWITH_IMAGEIO=ON -DBUILD_SHARED_LIBS=OFF -DWITH_GSTREAMER=ON ..
make all -j$(nproc) # Uses all machine cores
sudo make install
popd
fi
fi