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
24 if [ $(uname -s) = "Darwin" ]
30 function build_linux()
32 build_linux_unsecured $1 $2
34 build_linux_secured $1 $2
37 function build_linux_unsecured()
39 echo "*********** Build for linux ************"
43 function build_linux_unsecured_with_rm()
45 echo "*********** Build for linux with RoutingManager************"
46 scons ROUTING=GW RELEASE=$1 $2
49 function build_linux_secured()
51 echo "*********** Build for linux with Security *************"
52 scons RELEASE=$1 SECURED=1 $2
55 function build_linux_unsecured_with_ra()
58 echo "*********** Build for linux With Remote Access *************"
59 scons RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 $2
62 function build_linux_secured_with_ra()
64 echo "*********** Build for linux With Remote Access & Security ************"
65 scons RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 SECURED=1 $2
68 function build_android()
70 # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
71 # it requires gcc-4.9, currently only android-ndk-r10(for linux)
72 # and windows android-ndk-r10(64bit target version) support these features.
74 build_android_x86 $1 $2
75 build_android_x86_with_rm $1 $2
76 build_android_armeabi $1 $2
77 build_android_armeabi_with_rm $1 $2
80 function build_android_x86()
82 echo "*********** Build for android x86 *************"
83 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=IP $2
84 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BT $2
85 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BLE $2
88 function build_android_x86_with_rm()
90 echo "*********** Build for android x86 with Routing Manager *************"
91 scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=IP $2
92 scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BT $2
93 scons TARGET_OS=android TARGET_ARCH=x86 ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BLE $2
96 function build_android_armeabi()
98 echo "*********** Build for android armeabi *************"
99 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=IP $2
100 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BT $2
101 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BLE $2
104 function build_android_armeabi_with_rm()
106 echo "*********** Build for android armeabi with Routing Manager*************"
107 scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=IP $2
108 scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BT $2
109 scons TARGET_OS=android TARGET_ARCH=armeabi ROUTING=GW RELEASE=$1 TARGET_TRANSPORT=BLE $2
112 function build_arduino()
114 echo "*********** Build for arduino avr *************"
115 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
116 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
117 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=BLE SHIELD=RBL_NRF8001 RELEASE=$1 $2
119 echo "*********** Build for arduino arm *************"
120 scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
121 scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
122 # BLE support for the Arduino Due is currently unavailable.
125 function build_tizen()
127 echo "*********** Build for Tizen *************"
130 echo "*********** Build for Tizen CA lib and sample *************"
131 scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
133 echo "*********** Build for Tizen CA lib and sample with Security *************"
134 scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true SECURED=1 RELEASE=$1 $2
136 echo "*********** Build for Tizen octbstack lib and sample *************"
137 scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
139 echo "*********** Build for Tizen octbstack lib and sample with Routing Manager*************"
140 scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true ROUTING=GW RELEASE=$1 $2
143 function build_darwin() # Mac OSx and iOS
145 echo "*********** Build for OSX *************"
146 scons TARGET_OS=darwin SYS_VERSION=10.9 RELEASE=$1 $2
148 echo "*********** Build for IOS i386 *************"
149 scons TARGET_OS=ios TARGET_ARCH=i386 SYS_VERSION=7.0 RELEASE=$1 $2
151 echo "*********** Build for IOS x86_64 *************"
152 scons TARGET_OS=ios TARGET_ARCH=x86_64 SYS_VERSION=7.0 RELEASE=$1 $2
154 echo "*********** Build for IOS armv7 *************"
155 scons TARGET_OS=ios TARGET_ARCH=armv7 SYS_VERSION=7.0 RELEASE=$1 $2
157 echo "*********** Build for IOS armv7s *************"
158 scons TARGET_OS=ios TARGET_ARCH=armv7s SYS_VERSION=7.0 RELEASE=$1 $2
160 echo "*********** Build for IOS arm64 *************"
161 scons TARGET_OS=ios TARGET_ARCH=arm64 SYS_VERSION=7.0 RELEASE=$1 $2
164 function unit_tests()
166 echo "*********** Unit test Start *************"
167 scons resource RELEASE=false -c
168 scons resource LOGGING=false RELEASE=false
169 scons resource TEST=1 RELEASE=false
170 echo "*********** Unit test Stop *************"
177 echo " `basename $0` <target_build>"
178 echo " Allowed values for <target_build>: all, linux_unsecured, linux_secured, linux_unsecured_with_ra, linux_secured_with_ra, android, arduino, tizen, darwin"
179 echo " Note: \"linux\" will build \"linux_unsecured\", \"linux_secured\", \"linux_unsecured_with_ra\" & \"linux_secured_with_ra\"."
180 echo " Any selection will build both debug and release versions of all available targets in the scope you've"
181 echo " selected. To choose any specific command, please use the SCons commandline directly. Please refer"
182 echo " to [IOTIVITY_REPO]/Readme.scons.txt."
184 echo " `basename $0` -c"
187 # Suppress "Reading ..." message and enable parallel build
188 export SCONSFLAGS="-Q -j 4"
202 elif [ $1 = 'linux' ]
206 elif [ $1 = 'linux_unsecured' ]
208 build_linux_unsecured true
209 build_linux_unsecured false
210 build_linux_unsecured_with_rm true
211 build_linux_unsecured_with_rm false
212 elif [ $1 = 'linux_secured' ]
214 build_linux_secured true
215 build_linux_secured false
216 elif [ $1 = 'linux_unsecured_with_ra' ]
218 build_linux_unsecured_with_ra true
219 build_linux_unsecured_with_ra false
220 elif [ $1 = 'linux_secured_with_ra' ]
222 build_linux_secured_with_ra true
223 build_linux_secured_with_ra false
224 elif [ $1 = 'android' ]
228 elif [ $1 = 'android_x86' ]
230 build_android_x86 true
231 build_android_x86 false
232 build_android_x86_with_rm true
233 build_android_x86_with_rm false
234 elif [ $1 = 'android_armeabi' ]
236 build_android_armeabi true
237 build_android_armeabi false
238 build_android_armeabi_with_rm true
239 build_android_armeabi_with_rm false
240 elif [ $1 = 'arduino' ]
244 elif [ $1 = 'tizen' ]
248 elif [ $1 = 'darwin' ]
252 elif [ $1 = 'unit_tests' ]
269 echo "===================== done ====================="