-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·66 lines (50 loc) · 1.43 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
## 目标架构数组
abi_array=(armeabi-v7a arm64-v8a x86)
## 进入build目录
cd build
if [ $? -ne 0 ]; then
echo "\033[41;37mFAILED to cd build !!\033[0m\n"
else
echo "\033[42;35mSUCCEED to cd build !!\033[0m\n"
fi
## 遍历架构数组 编译目标架构产物
for (( i=0; i < ${#abi_array[@]}; i++)) do
## 清空cmake中间文件
rm -rf *
if [ $? -ne 0 ]; then
echo "\033[41;37mFAILED to clean !!\033[0m\n"
else
echo "\033[42;35mSUCCEED to clean !!\033[0m\n"
fi
echo "\n\033[44;37mStart to build ABI of "${abi_array[i]}"\033[0m";
## 生存编译配置文件
cmake .. \
-DANDROID_ABI=${abi_array[i]} \
-G Ninja
if [ $? -ne 0 ]; then
echo "\033[41;37mFAILED to Configuring and Generating Build files !!\033[0m\n"
else
echo "\033[42;35mSUCCEED to Configuring and Generating Build files !!\033[0m\n"
fi
## 编译
cmake --build .
if [ $? -ne 0 ]; then
echo "\033[41;37mFAILED to build !!\033[0m\n"
else
echo "\033[42;35mSUCCEED to build !!\033[0m\n"
fi
## 清空cmake中间文件
rm -rf *
if [ $? -ne 0 ]; then
echo "\033[41;37mFAILED to clean !!\033[0m\n"
else
echo "\033[42;35mSUCCEED to clean !!\033[0m\n"
fi
done;
## 离开build目录
cd ..
if [ $? -ne 0 ]; then
echo "\033[41;37mFAILED to exit build !!\033[0m\n"
else
echo "\033[42;35mSUCCEED to exit build !!\033[0m\n"
fi