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
26 if [ $(uname -s) = "Darwin" ]
32 function build_linux()
34 build_linux_unsecured $1 $2
36 build_linux_secured $1 $2
39 function build_linux_unsecured()
41 echo "*********** Build for linux ************"
45 function build_linux_unsecured_with_rm()
47 echo "*********** Build for linux with RoutingManager************"
48 scons ROUTING=GW RELEASE=$1 $2
51 function build_linux_secured()
53 echo "*********** Build for linux with Security *************"
54 scons RELEASE=$1 SECURED=1 $2
57 function build_linux_unsecured_with_ra()
60 echo "*********** Build for linux With Remote Access *************"
61 scons RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 $2
64 function build_linux_secured_with_ra()
66 echo "*********** Build for linux With Remote Access & Security ************"
67 scons RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 SECURED=1 $2
70 function build_linux_unsecured_with_rd()
72 echo "*********** Build for linux With Resource Directory *************"
73 scons RELEASE=$1 WITH_RD=1 $2
76 function build_linux_secured_with_rd()
78 echo "*********** Build for linux With Resource Directory & Security ************"
79 scons RELEASE=$1 WITH_RD=1 SECURED=1 $2
82 function build_android()
84 # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
85 # it requires gcc-4.9, currently only android-ndk-r10(for linux)
86 # and windows android-ndk-r10(64bit target version) support these features.
88 build_android_x86 $1 $2
89 build_android_x86_with_rm $1 $2
90 build_android_armeabi $1 $2
91 build_android_armeabi_with_rm $1 $2
94 function build_android_x86()
96 echo "*********** Build for android x86 *************"
97 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=IP $2
98 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BT $2
99 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BLE $2
102 function build_android_x86_with_rm()
104 echo "*********** Build for android x86 with Routing Manager *************"
105 scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=IP $2
106 scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BT $2
107 scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BLE $2
110 function build_android_armeabi()
112 echo "*********** Build for android armeabi *************"
113 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=IP $2
114 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BT $2
115 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BLE $2
118 function build_android_armeabi_with_rm()
120 echo "*********** Build for android armeabi with Routing Manager*************"
121 scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=IP $2
122 scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BT $2
123 scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BLE $2
126 function build_arduino()
128 echo "*********** Build for arduino avr *************"
129 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
130 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
131 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=BLE SHIELD=RBL_NRF8001 RELEASE=$1 $2
133 echo "*********** Build for arduino arm *************"
134 scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
135 scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
136 # BLE support for the Arduino Due is currently unavailable.
139 function build_tizen()
141 echo "*********** Build for Tizen *************"
144 echo "*********** Build for Tizen CA lib and sample *************"
145 scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
147 echo "*********** Build for Tizen CA lib and sample with Security *************"
148 scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true SECURED=1 RELEASE=$1 $2
150 echo "*********** Build for Tizen octbstack lib and sample *************"
151 scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
153 echo "*********** Build for Tizen octbstack lib and sample with Security*************"
154 scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true SECURED=1 RELEASE=$1 $2
156 echo "*********** Build for Tizen octbstack lib and sample with Routing Manager*************"
157 scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true ROUTING=GW RELEASE=$1 $2
160 function build_darwin() # Mac OSx and iOS
162 echo "*********** Build for OSX *************"
163 scons TARGET_OS=darwin SYS_VERSION=10.9 RELEASE=$1 $2
165 echo "*********** Build for IOS i386 *************"
166 scons TARGET_OS=ios TARGET_ARCH=i386 SYS_VERSION=7.0 RELEASE=$1 $2
168 echo "*********** Build for IOS x86_64 *************"
169 scons TARGET_OS=ios TARGET_ARCH=x86_64 SYS_VERSION=7.0 RELEASE=$1 $2
171 echo "*********** Build for IOS armv7 *************"
172 scons TARGET_OS=ios TARGET_ARCH=armv7 SYS_VERSION=7.0 RELEASE=$1 $2
174 echo "*********** Build for IOS armv7s *************"
175 scons TARGET_OS=ios TARGET_ARCH=armv7s SYS_VERSION=7.0 RELEASE=$1 $2
177 echo "*********** Build for IOS arm64 *************"
178 scons TARGET_OS=ios TARGET_ARCH=arm64 SYS_VERSION=7.0 RELEASE=$1 $2
181 function unit_tests()
183 echo "*********** Unit test Start *************"
184 scons resource RELEASE=false -c
185 scons resource LOGGING=false RELEASE=false
186 scons resource TEST=1 RELEASE=false
187 echo "*********** Unit test Stop *************"
194 echo " `basename $0` <target_build>"
195 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"
196 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\"."
197 echo " Any selection will build both debug and release versions of all available targets in the scope you've"
198 echo " selected. To choose any specific command, please use the SCons commandline directly. Please refer"
199 echo " to [IOTIVITY_REPO]/Readme.scons.txt."
201 echo " `basename $0` -c"
204 # Suppress "Reading ..." message and enable parallel build
205 export SCONSFLAGS="-Q -j 4"
219 elif [ $1 = 'linux' ]
223 elif [ $1 = 'linux_unsecured' ]
225 build_linux_unsecured true
226 build_linux_unsecured false
227 build_linux_unsecured_with_rm true
228 build_linux_unsecured_with_rm false
229 elif [ $1 = 'linux_secured' ]
231 build_linux_secured true
232 build_linux_secured false
233 elif [ $1 = 'linux_unsecured_with_ra' ]
235 build_linux_unsecured_with_ra true
236 build_linux_unsecured_with_ra false
237 elif [ $1 = 'linux_secured_with_ra' ]
239 build_linux_secured_with_ra true
240 build_linux_secured_with_ra false
241 elif [ $1 = 'linux_unsecured_with_rd' ]
243 build_linux_unsecured_with_rd true
244 build_linux_unsecured_with_rd false
245 elif [ $1 = 'linux_secured_with_rd' ]
247 build_linux_secured_with_rd true
248 build_linux_secured_with_rd false
249 elif [ $1 = 'android' ]
253 elif [ $1 = 'android_x86' ]
255 build_android_x86 true
256 build_android_x86 false
257 build_android_x86_with_rm true
258 build_android_x86_with_rm false
259 elif [ $1 = 'android_armeabi' ]
261 build_android_armeabi true
262 build_android_armeabi false
263 build_android_armeabi_with_rm true
264 build_android_armeabi_with_rm false
265 elif [ $1 = 'arduino' ]
269 elif [ $1 = 'tizen' ]
273 elif [ $1 = 'darwin' ]
277 elif [ $1 = 'unit_tests' ]
294 echo "===================== done ====================="