-
Notifications
You must be signed in to change notification settings - Fork 160
/
Copy pathauto_build.sh
executable file
·103 lines (83 loc) · 2.8 KB
/
auto_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
#! /bin/bash
# Ideally we will capture the exit code of each step and try them all before failing
# the build script. For now, use set -e and fail the build at first failure.
set -e
function clean()
{
echo "*********** Clean build *************"
scons -c
rm -rf out
}
function build()
{
if [ $(uname -s) = "Linux" ]
then
echo "*********** Build for linux *************"
scons RELEASE=$3
fi
# Note: for android, as oic-resource uses C++11 feature stoi and to_string,
# it requires gcc-4.9, currently only android-ndk-r10(for linux)
# and windows android-ndk-r10(64bit target version) support these features.
if [ "$BUILD_FOR_ANDROID" = "true" ]
then
echo "*********** Build Boost for android ***********"
pushd extlibs
./buildDependencies.sh
popd
echo "*********** Build for android x86 *************"
scons TARGET_OS=android TARGET_ARCH=x86 ANDROID_NDK=$1 RELEASE=$3
echo "*********** Build for android armeabi *************"
scons TARGET_OS=android TARGET_ARCH=armeabi ANDROID_NDK=$1 RELEASE=$3
echo "*********** Build for android armeabi-v7a *************"
scons TARGET_OS=android TARGET_ARCH=armeabi-v7a ANDROID_NDK=$1 RELEASE=$3
echo "*********** Build for android armeabi-v7a-hard *************"
scons TARGET_OS=android TARGET_ARCH=armeabi-v7a-hard ANDROID_NDK=$1 RELEASE=$3
fi
echo "*********** Build for arduino avr *************"
scons TARGET_OS=arduino TARGET_ARCH=avr ARDUINO_HOME=$2 RELEASE=$3
echo "*********** Build for arduino arm *************"
scons TARGET_OS=arduino TARGET_ARCH=arm ARDUINO_HOME=$2 RELEASE=$3
if [ $(uname -s) = "Darwin" ]
then
echo "*********** Build for OSX *************"
scons TARGET_OS=darwin SYS_VERSION=10.9 RELEASE=$3
echo "*********** Build for IOS i386 *************"
scons TARGET_OS=ios TARGET_ARCH=i386 SYS_VERSION=7.0 RELEASE=$3
echo "*********** Build for IOS x86_64 *************"
scons TARGET_OS=ios TARGET_ARCH=x86_64 SYS_VERSION=7.0 RELEASE=$3
echo "*********** Build for IOS armv7 *************"
scons TARGET_OS=ios TARGET_ARCH=armv7 SYS_VERSION=7.0 RELEASE=$3
echo "*********** Build for IOS armv7s *************"
scons TARGET_OS=ios TARGET_ARCH=armv7s SYS_VERSION=7.0 RELEASE=$3
echo "*********** Build for IOS arm64 *************"
scons TARGET_OS=ios TARGET_ARCH=arm64 SYS_VERSION=7.0 RELEASE=$3
fi
}
function help()
{
echo "Usage:"
echo " build:"
echo " `basename $0` <path-to-android-ndk> <path-to-arduino-home>"
echo " clean:"
echo " `basename $0` -c"
}
if [ $# -eq 1 ]
then
if [ $1 = '-c' ]
then
clean
exit 0
else
help
exit -1
fi
elif [ $# -ne 2 ]
then
help
exit -1
fi
# Suppress "Reading ..." message and enable parallel build
export SCONSFLAGS="-Q -j 4"
build $1 $2 true
build $1 $2 false
echo "===================== done ====================="