-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.sh
executable file
·150 lines (117 loc) · 2.41 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/sh
# build.sh
#
#
#===============================================================================
# Functions
#===============================================================================
abort()
{
echo
echo "Aborted: $@"
exit 1
}
doneSection()
{
echo
echo " ================================================================="
echo " Done"
echo
}
witeMessage()
{
echo
echo " ================================================================="
echo " $1"
echo " ================================================================="
echo
}
#===============================================================================
POCO_VER=$1
POCO_DIR=${PWD}/Poco/poco-$POCO_VER
IOS_VER=$2
BUILD=$3
FRESH_BUILD=$4
cleanFiles()
{
witeMessage "Cleaning Poco $POCO_VER"
pushd ${PWD}
cd $POCO_DIR
make clean
rm -f -R lib
popd
rm -f -R Platform/Android/lib
rm -f -R Platform/iOS/lib
rm -f -R Platform/MacOS/lib
rm -f -R Build/iOS
rm -f -R Build/Android
rm -f -R Build/Darwin
doneSection
}
buildMacOS()
{
witeMessage "Building Poco $POCO_VER for Mac OS"
pushd ${PWD}
cd Platform/MacOS
./build_macos.sh $POCO_DIR
popd
#Move built libs and headers to Output dir
mv $POCO_DIR/lib/Darwin Build/
doneSection
}
buildAndroid()
{
witeMessage "Building Poco $POCO_VER for Android"
pushd ${PWD}
cd Platform/Android
./build_android.sh $POCO_DIR
popd
#Move built libs and headers to Output dir
mv $POCO_DIR/lib/Android Build/
doneSection
}
buildiOS()
{
witeMessage "Building Poco $POCO_VER for iOS $IOS_VER"
pushd ${PWD}
cd Platform/iOS
./build_ios.sh $IOS_VER $POCO_DIR $POCO_VER
popd
#Move built libs and headers to Output dir
mv $POCO_DIR/lib/iOS Build/
mv $POCO_DIR/lib/iPhoneOS Build/iOS/
mv $POCO_DIR/lib/iPhoneSimulator Build/iOS/
doneSection
}
#Execution begins here
if [ $# -eq 0 ]
then
witeMessage "Usage: build.sh POCO_VERSION [IOS_VERSION] (ALL|Mobile|iOS|Android|MacOS) [CLEAN|CLEAN-ONLY]\n"
exit 1
fi
if [ "$FRESH_BUILD" == 'CLEAN' ]; then
cleanFiles
elif [ "$FRESH_BUILD" == 'CLEAN-ONLY' ]; then
cleanFiles
exit 1
fi
#Go ahead
if [ "$BUILD" == 'ALL' ]; then
buildAndroid
buildiOS
buildMacOS
elif [ "$BUILD" == 'Mobile' ]; then
buildAndroid
buildiOS
elif [ "$BUILD" == 'iOS' ]; then
buildiOS
elif [ "$BUILD" == 'Android' ]; then
buildAndroid
elif [ "$BUILD" == 'MacOS' ]; then
buildMacOS
#witeMessage "MacOS build needs some work..."
#exit 1
else
witeMessage "No target platform(ALL, iOS, Android or MacOS) specified."
exit 1
fi