-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·99 lines (99 loc) · 3.01 KB
/
build.sh
File metadata and controls
executable file
·99 lines (99 loc) · 3.01 KB
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
#!/bin/bash
echo "-------- Begin '$(uname)' building ... --------"
PWD=$(pwd)
if [ "$1" == "test" ]
then
cd "${PWD}/LinxSrvc/3rd";
git submodule update --init --recursive
if [ ! $(whereis lcov | awk '{print $2}') ]
then
if [ ! -d "lcov" ]; then
git clone https://github.com/linux-test-project/lcov.git
fi
cd lcov
git pull origin main --rebase=false
make -j4 && sudo make install
cd -
fi
if [ $(ls googletest | wc -l) -le 0 ]
then
git clone https://github.com/google/googletest.git
git pull origin main --rebase=false
fi
cd ../test && ./test.sh
else
if [[ "$1" == "Qt"* ]]; then
if [ -d "$1" ]; then
cd "$1"
if [ -x /usr/bin/qmake ]; then
proj=$(echo "${1}" | sed 's/\/*$//')
qmake "${proj}.pro"
make all -j4
else
echo Not support "$1" build!
fi
cd -
fi
exit 0
fi
cd "${PWD}/LinxSrvc"
folders=( $(find . -maxdepth 1 -type d ! -path . -exec basename {} \;))
status=0
for path in "${folders[@]}"; do
if [ -f "$path/CMakeLists.txt" ] && [[ "$1" == "$path" ]]; then
if [ ! -d "$path/build" ]; then mkdir "$path/build"; fi;
cd "$path/build"
cmake ..
make -j4
cd -
status=1
break
fi
done
if [ "$1" != "clean" ]
then
if [ ! -d bin ]; then mkdir bin; fi;
if [ ! -d gen ]; then mkdir gen; fi;
if [ ! -d out ]; then mkdir out; fi;
if [ ! -d kos ]; then mkdir kos; fi;
else
for built in "${folders[@]}"; do
if [ -d "$built/build" ]; then rm -rvf "$built/build"; fi;
done
fi
if [ $status != 1 ]; then make "$@" --no-print-directory; fi;
if [ "$1" == "clean" ]
then
shopt -s nullglob
files=$(ls ../build* 2> /dev/null | wc -l)
if [ "${#files[@]}" != "0" ]; then
rm -rvf ../build
# find ./build* ! -name 'build.sh' -exec rm -rvf {} +
fi
if [ -d "build" ]; then rm -rvf lib build; fi;
ARR_WIN=($(ls -d ../*/ | awk '{gsub("\\.\\./", "", $1); print $1}' | tr '/\n' ' '))
for i in "${ARR_WIN[@]}"; do
cd "../$i"
if [[ "$i" == "Qt"* ]]; then
which qmake >/dev/null 2>&1
if [ $? -eq 0 ]; then
if [ -f "./Makefile" ]; then
make clean || true
fi
rm -rvf -- GeneratedFiles* ./.*.stash ./*.user* ./*.qtvscr ./*.TMP
fi
fi
ARR_SUB=(Debug */*Debug MFC cache build ./*.o .vs)
for j in "${ARR_SUB[@]}";
do
rm -rvf "$j"
done
cd -
done
if [ -d "test/build" ]; then
cd test; ./test.sh clean; cd -;
fi
fi
fi
echo "-------- All '$1' build progress(es) finish --------"
exit 0;