forked from weiboad/adbase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmake.sh
executable file
·69 lines (63 loc) · 1.31 KB
/
cmake.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
#!/bin/bash
#{{{ options
echo "Start cmake configure....."
echo -e "\033[31m\033[05m编译 Debug 级别 [Debug(D)|Release(R)]: \033[0m\c"
read makelevel
case $makelevel in
Debug | D )
CMAKE_BUILD_TYPE="Debug";;
Release | R )
CMAKE_BUILD_TYPE="Release";;
*)
CMAKE_BUILD_TYPE="Debug";;
esac
echo -e "\033[31m\033[05m编译环境[32bit(32)|64bit(64)]: \033[0m\c"
read makebit
case $makebit in
32bit | 32 )
M32=1;;
64bit | 64 )
M32=0;;
*)
M32=0;;
esac
echo -e "\033[31m\033[05m安装 adbase_kafka 模块 [Y|N]: \033[0m\c"
read usekafka
case $usekafka in
Y | y )
USEKAFKA=1;;
N | n )
USEKAFKA=0;;
*)
USEKAFKA=1;;
esac
echo -e "\033[31m\033[05m是否是开发模式 [Y|N]: \033[0m\c"
read isdev
case $isdev in
Y | y )
DEV=1;;
N | n )
DEV=0;;
*)
DEV=1;;
esac
# }}}
# 计算版本号
LAST_TAG=`git tag|tail -n 1`
VERSION=${LAST_TAG/v/}
VERSION_TMP=(${VERSION//\./ })
SOVERSION=${VERSION_TMP[0]}
# 判断是否打标签
COMMITDIFFNUM=`git diff HEAD $LAST_TAG --numstat |wc -l`
if [ $COMMITDIFFNUM -gt 0 ]; then
SOVERSION=999
fi
CMD="cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DM32=$M32 -DUSEKAFKA=$USEKAFKA -DADINFVERSION=$VERSION -DADINFSOVERSION=$SOVERSION -DDEV=$DEV -DCMAKE_CXX_COMPILER=g++ .."
if [ -d ./build ]; then
echo "mkdir build.";
else
mkdir ./build;
fi
cd ./build;
echo $CMD
eval $CMD