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_rm $1 $2
16 build_linux_unsecured_with_rd $1 $2
17 build_linux_secured_with_rd $1 $2
27 if [ $(uname -s) = "Darwin" ]
33 function build_linux()
35 build_linux_unsecured $1 $2
37 build_linux_secured $1 $2
40 function build_linux_unsecured()
42 echo "*********** Build for linux ************"
46 function build_linux_unsecured_with_rm()
48 echo "*********** Build for linux with RoutingManager************"
49 scons ROUTING=GW RELEASE=$1 $2
52 function build_linux_secured()
54 echo "*********** Build for linux with Security *************"
55 scons RELEASE=$1 SECURED=1 $2
58 function build_linux_unsecured_with_ra()
61 echo "*********** Build for linux With Remote Access *************"
62 scons RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 $2
65 function build_linux_secured_with_ra()
67 echo "*********** Build for linux With Remote Access & Security ************"
68 scons RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 SECURED=1 $2
71 function build_linux_unsecured_with_rd()
73 echo "*********** Build for linux With Resource Directory *************"
74 scons RELEASE=$1 WITH_RD=1 $2
77 function build_linux_secured_with_rd()
79 echo "*********** Build for linux With Resource Directory & Security ************"
80 scons RELEASE=$1 WITH_RD=1 SECURED=1 $2
83 function build_android()
85 # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
86 # it requires gcc-4.9, currently only android-ndk-r10(for linux)
87 # and windows android-ndk-r10(64bit target version) support these features.
89 build_android_x86 $1 $2
90 build_android_x86_with_rm $1 $2
91 build_android_armeabi $1 $2
92 build_android_armeabi_with_rm $1 $2
95 function build_android_x86()
97 echo "*********** Build for android x86 *************"
98 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=IP $2
99 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BT $2
100 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BLE $2
103 function build_android_x86_with_rm()
105 echo "*********** Build for android x86 with Routing Manager *************"
106 scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=IP $2
107 scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BT $2
108 scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BLE $2
111 function build_android_armeabi()
113 echo "*********** Build for android armeabi *************"
114 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=IP $2
115 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BT $2
116 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BLE $2
119 function build_android_armeabi_with_rm()
121 echo "*********** Build for android armeabi with Routing Manager*************"
122 scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=IP $2
123 scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BT $2
124 scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BLE $2
127 function build_arduino()
129 echo "*********** Build for arduino avr *************"
130 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
131 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
132 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=BLE SHIELD=RBL_NRF8001 RELEASE=$1 $2
134 echo "*********** Build for arduino arm *************"
135 scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
136 scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
137 # BLE support for the Arduino Due is currently unavailable.
140 function build_tizen()
142 echo "*********** Build for Tizen *************"
145 echo "*********** Build for Tizen octbstack lib and sample *************"
146 scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
148 echo "*********** Build for Tizen octbstack lib and sample with Security*************"
149 scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true SECURED=1 RELEASE=$1 $2
151 echo "*********** Build for Tizen octbstack lib and sample with Routing Manager*************"
152 scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true ROUTING=GW RELEASE=$1 $2
155 function build_darwin() # Mac OSx and iOS
157 echo "*********** Build for OSX *************"
158 scons TARGET_OS=darwin SYS_VERSION=10.9 RELEASE=$1 $2
160 echo "*********** Build for IOS i386 *************"
161 scons TARGET_OS=ios TARGET_ARCH=i386 SYS_VERSION=7.0 RELEASE=$1 $2
163 echo "*********** Build for IOS x86_64 *************"
164 scons TARGET_OS=ios TARGET_ARCH=x86_64 SYS_VERSION=7.0 RELEASE=$1 $2
166 echo "*********** Build for IOS armv7 *************"
167 scons TARGET_OS=ios TARGET_ARCH=armv7 SYS_VERSION=7.0 RELEASE=$1 $2
169 echo "*********** Build for IOS armv7s *************"
170 scons TARGET_OS=ios TARGET_ARCH=armv7s SYS_VERSION=7.0 RELEASE=$1 $2
172 echo "*********** Build for IOS arm64 *************"
173 scons TARGET_OS=ios TARGET_ARCH=arm64 SYS_VERSION=7.0 RELEASE=$1 $2
176 function build_simulator()
178 echo "*********** Build for simulator plugin *************"
179 scons SIMULATOR=1 RELEASE=$1 $2
182 function unit_tests()
184 echo "*********** Unit test Start *************"
185 scons resource RELEASE=false -c
186 scons resource LOGGING=false RELEASE=false
187 scons resource TEST=1 RELEASE=false
188 echo "*********** Unit test Stop *************"
195 echo " `basename $0` <target_build>"
196 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, simulator darwin"
197 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\"."
198 echo " Any selection will build both debug and release versions of all available targets in the scope you've"
199 echo " selected. To choose any specific command, please use the SCons commandline directly. Please refer"
200 echo " to [IOTIVITY_REPO]/Readme.scons.txt."
202 echo " `basename $0` -c"
205 # Suppress "Reading ..." message and enable parallel build
206 export SCONSFLAGS="-Q -j 4"
220 elif [ $1 = 'linux' ]
224 elif [ $1 = 'linux_unsecured' ]
226 build_linux_unsecured true
227 build_linux_unsecured false
228 build_linux_unsecured_with_rm true
229 build_linux_unsecured_with_rm false
230 elif [ $1 = 'linux_secured' ]
232 build_linux_secured true
233 build_linux_secured false
234 elif [ $1 = 'linux_unsecured_with_ra' ]
236 build_linux_unsecured_with_ra true
237 build_linux_unsecured_with_ra false
238 elif [ $1 = 'linux_secured_with_ra' ]
240 build_linux_secured_with_ra true
241 build_linux_secured_with_ra false
242 elif [ $1 = 'linux_unsecured_with_rd' ]
244 build_linux_unsecured_with_rd true
245 build_linux_unsecured_with_rd false
246 elif [ $1 = 'linux_secured_with_rd' ]
248 build_linux_secured_with_rd true
249 build_linux_secured_with_rd false
250 elif [ $1 = 'android' ]
254 elif [ $1 = 'android_x86' ]
256 build_android_x86 true
257 build_android_x86 false
258 build_android_x86_with_rm true
259 build_android_x86_with_rm false
260 elif [ $1 = 'android_armeabi' ]
262 build_android_armeabi true
263 build_android_armeabi false
264 build_android_armeabi_with_rm true
265 build_android_armeabi_with_rm false
266 elif [ $1 = 'arduino' ]
270 elif [ $1 = 'tizen' ]
274 elif [ $1 = 'simulator' ]
277 build_simulator false
278 elif [ $1 = 'darwin' ]
282 elif [ $1 = 'unit_tests' ]
299 echo "===================== done ====================="