forked from jiwenchen/MonkeyGL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
131 lines (116 loc) · 2.68 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
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
argNum=$#
source_path=$(pwd)
build_path=${source_path}"/build"
py_source_path=${source_path}"/pybind11_interface"
py_build_path=${source_path}"/pybind11_interface/build"
build_type=$2
makesure_folder(){
if [ ! -d $1 ];then
mkdir $1
fi
}
remove_folder(){
if [ -d $1 ];then
echo "remove folder: " $1
rm -rf $1
fi
}
build_zlib() {
makesure_folder ${build_path}
cd ${build_path}
if [ ${build_type} == "Clean" ]; then
echo "clean zlib build"
rm -rf ./zlib-1.2.11
else
if [ ! -d "./zlib-1.2.11" ];then
tar -xvzf ../ThirdPartyDownloads/zlib-1.2.11.tar.gz
fi
cd ./zlib-1.2.11
if [ ! -d "./build" ];then
mkdir build
cd ./build
cmake ../ -DCMAKE_BUILD_TYPE=${build_type}
make DESTDIR=./install install
fi
fi
}
build_webp() {
makesure_folder ${build_path}
cd ${build_path}
if [ ${build_type} == "Clean" ]; then
echo "clean webp build"
rm -rf ./libwebp-1.2.2
else
if [ ! -d "./libwebp-1.2.2" ];then
tar -xvzf ../ThirdPartyDownloads/libwebp-1.2.2.tar.gz
fi
cd ./libwebp-1.2.2
if [ ! -d "./build" ];then
mkdir build
cd ./build
cmake ../ -DCMAKE_BUILD_TYPE=${build_type} -DBUILD_SHARED_LIBS=true
make DESTDIR=./install install
fi
fi
}
build_log_lib() {
makesure_folder ${build_path}
cd ${build_path}
if [ ${build_type} == "Clean" ]; then
echo "clean log build"
rm -rf ./log4cplus-2.0.7
else
if [ ! -d "./log4cplus-2.0.7" ];then
unzip ../ThirdPartyDownloads/log4cplus-2.0.7.zip
fi
cd ./log4cplus-2.0.7
if [ ! -d "./build" ];then
mkdir build
cd ./build
cmake ../ -DCMAKE_BUILD_TYPE=${build_type}
make DESTDIR=./install install
fi
fi
}
build_cpp_lib() {
makesure_folder ${build_path}
cd ${build_path}
if [ ${build_type} == "Clean" ]; then
echo "clean cpp build"
rm -rf ./*
else
cmake ../ -DCMAKE_BUILD_TYPE=${build_type} -DSSE=1
make
fi
}
build_cpp() {
build_log_lib
build_cpp_lib
}
build_pybind() {
cd ${py_source_path}
if [ ! -d "./pybind11" ];then
tar -xvzf ../ThirdPartyDownloads/pybind11.tar.gz ./
fi
makesure_folder ${py_build_path}
cd ${py_build_path}
if [ ${build_type} == "Clean" ]; then
echo "clean pybind build"
rm -rf ./*
else
cmake ../ -DCMAKE_BUILD_TYPE=${build_type}
make
fi
}
if [ $1 == "cpp" ]; then
build_cpp
elif [ $1 == "log" ]; then
build_log
elif [ $1 == "pybind" ]; then
build_pybind
elif [ $1 == "all" ]; then
build_cpp
build_pybind
else
echo "invalid project"
fi