3 # Ideally we will capture the exit code of each step and try them all before failing
4 # the build script. For now, use set -e and fail the build at first failure.
9 if [ $(uname -s) = "Linux" ]
11 build_linux_unsecured $1 $2
12 build_linux_secured $1 $2
13 build_linux_unsecured_with_ra $1 $2
14 build_linux_secured_with_ra $1 $2
15 build_linux_unsecured_with_rd $1 $2
16 build_linux_secured_with_rd $1 $2
25 if [ $(uname -s) = "Darwin" ]
31 function build_linux()
33 build_linux_unsecured $1 $2
35 build_linux_secured $1 $2
38 function build_linux_unsecured()
40 echo "*********** Build for linux ************"
44 function build_linux_secured()
46 echo "*********** Build for linux with Security *************"
47 scons RELEASE=$1 SECURED=1 $2
50 function build_linux_unsecured_with_ra()
53 echo "*********** Build for linux With Remote Access *************"
54 scons RELEASE=$1 WITH_RA=1 $2
57 function build_linux_secured_with_ra()
59 echo "*********** Build for linux With Remote Access & Security ************"
60 scons RELEASE=$1 WITH_RA=1 SECURED=1 $2
63 function build_linux_unsecured_with_rd()
65 echo "*********** Build for linux With Resource Directory *************"
66 scons RELEASE=$1 WITH_RD=1 $2
69 function build_linux_secured_with_rd()
71 echo "*********** Build for linux With Resource Directory & Security ************"
72 scons RELEASE=$1 WITH_RD=1 SECURED=1 $2
75 function build_android()
77 # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
78 # it requires gcc-4.9, currently only android-ndk-r10(for linux)
79 # and windows android-ndk-r10(64bit target version) support these features.
80 echo "*********** Build Boost for android ***********"
81 # disable parallel build for android as gradle depends on scons to finish first
82 export SCONSFLAGS="-Q"
84 echo "*********** Build for android x86 *************"
85 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=IP $2
87 echo "*********** Build for android armeabi *************"
88 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=IP $2
90 # enable parallel build
91 export SCONSFLAGS="-Q -j 4"
94 function build_arduino()
96 echo "*********** Build for arduino avr *************"
97 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
98 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
100 echo "*********** Build for arduino arm *************"
101 scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
102 scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
105 function build_tizen()
107 echo "*********** Build for Tizen CA lib and sample *************"
108 scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
110 echo "*********** Build for Tizen CA lib and sample with Security *************"
111 scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true SECURED=1 RELEASE=$1 $2
114 function build_darwin() # Mac OSx and iOS
116 echo "*********** Build for OSX *************"
117 scons TARGET_OS=darwin SYS_VERSION=10.9 RELEASE=$1 $2
119 echo "*********** Build for IOS i386 *************"
120 scons TARGET_OS=ios TARGET_ARCH=i386 SYS_VERSION=7.0 RELEASE=$1 $2
122 echo "*********** Build for IOS x86_64 *************"
123 scons TARGET_OS=ios TARGET_ARCH=x86_64 SYS_VERSION=7.0 RELEASE=$1 $2
125 echo "*********** Build for IOS armv7 *************"
126 scons TARGET_OS=ios TARGET_ARCH=armv7 SYS_VERSION=7.0 RELEASE=$1 $2
128 echo "*********** Build for IOS armv7s *************"
129 scons TARGET_OS=ios TARGET_ARCH=armv7s SYS_VERSION=7.0 RELEASE=$1 $2
131 echo "*********** Build for IOS arm64 *************"
132 scons TARGET_OS=ios TARGET_ARCH=arm64 SYS_VERSION=7.0 RELEASE=$1 $2
135 function unit_tests()
137 echo "*********** Unit test Start *************"
138 scons resource RELEASE=false -c
139 scons resource LOGGING=false RELEASE=false
140 scons resource TEST=1 RELEASE=false
141 echo "*********** Unit test Stop *************"
148 echo " `basename $0` <target_build>"
149 echo " Allowed values for <target_build>: all, linux_unsecured, linux_secured, linux_unsecured_with_ra, linux_secured_with_ra, linux_unsecured_with_rd, linux_secured_with_rd, android, arduino, tizen, darwin"
150 echo " Note: \"linux\" will build \"linux_unsecured\", \"linux_secured\", \"linux_unsecured_with_ra\", \"linux_secured_with_ra\", \"linux_secured_with_rd\" & \"linux_unsecured_with_rd\"."
151 echo " Any selection will build both debug and release versions of all available targets in the scope you've"
152 echo " selected. To choose any specific command, please use the SCons commandline directly. Please refer"
153 echo " to [IOTIVITY_REPO]/Readme.scons.txt."
155 echo " `basename $0` -c"
158 # Suppress "Reading ..." message and enable parallel build
159 export SCONSFLAGS="-Q -j 4"
173 elif [ $1 = 'linux' ]
177 elif [ $1 = 'linux_unsecured' ]
179 build_linux_unsecured true
180 build_linux_unsecured false
181 elif [ $1 = 'linux_secured' ]
183 build_linux_secured true
184 build_linux_secured false
185 elif [ $1 = 'linux_unsecured_with_ra' ]
187 build_linux_unsecured_with_ra true
188 build_linux_unsecured_with_ra false
189 elif [ $1 = 'linux_secured_with_ra' ]
191 build_linux_secured_with_ra true
192 build_linux_secured_with_ra false
193 elif [ $1 = 'linux_unsecured_with_rd' ]
195 build_linux_unsecured_with_rd true
196 build_linux_unsecured_with_rd false
197 elif [ $1 = 'linux_secured_with_rd' ]
199 build_linux_secured_with_rd true
200 build_linux_secured_with_rd false
201 elif [ $1 = 'android' ]
205 elif [ $1 = 'arduino' ]
209 elif [ $1 = 'tizen' ]
213 elif [ $1 = 'darwin' ]
217 elif [ $1 = 'unit_tests' ]
234 echo "===================== done ====================="