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 Routing Manager*************"
154 scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true ROUTING=GW RELEASE=$1 $2
157 function build_darwin() # Mac OSx and iOS
159 echo "*********** Build for OSX *************"
160 scons TARGET_OS=darwin SYS_VERSION=10.9 RELEASE=$1 $2
162 echo "*********** Build for IOS i386 *************"
163 scons TARGET_OS=ios TARGET_ARCH=i386 SYS_VERSION=7.0 RELEASE=$1 $2
165 echo "*********** Build for IOS x86_64 *************"
166 scons TARGET_OS=ios TARGET_ARCH=x86_64 SYS_VERSION=7.0 RELEASE=$1 $2
168 echo "*********** Build for IOS armv7 *************"
169 scons TARGET_OS=ios TARGET_ARCH=armv7 SYS_VERSION=7.0 RELEASE=$1 $2
171 echo "*********** Build for IOS armv7s *************"
172 scons TARGET_OS=ios TARGET_ARCH=armv7s SYS_VERSION=7.0 RELEASE=$1 $2
174 echo "*********** Build for IOS arm64 *************"
175 scons TARGET_OS=ios TARGET_ARCH=arm64 SYS_VERSION=7.0 RELEASE=$1 $2
178 function unit_tests()
180 echo "*********** Unit test Start *************"
181 scons resource RELEASE=false -c
182 scons resource LOGGING=false RELEASE=false
183 scons resource TEST=1 RELEASE=false
184 echo "*********** Unit test Stop *************"
191 echo " `basename $0` <target_build>"
192 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"
193 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\"."
194 echo " Any selection will build both debug and release versions of all available targets in the scope you've"
195 echo " selected. To choose any specific command, please use the SCons commandline directly. Please refer"
196 echo " to [IOTIVITY_REPO]/Readme.scons.txt."
198 echo " `basename $0` -c"
201 # Suppress "Reading ..." message and enable parallel build
202 export SCONSFLAGS="-Q -j 4"
216 elif [ $1 = 'linux' ]
220 elif [ $1 = 'linux_unsecured' ]
222 build_linux_unsecured true
223 build_linux_unsecured false
224 build_linux_unsecured_with_rm true
225 build_linux_unsecured_with_rm false
226 elif [ $1 = 'linux_secured' ]
228 build_linux_secured true
229 build_linux_secured false
230 elif [ $1 = 'linux_unsecured_with_ra' ]
232 build_linux_unsecured_with_ra true
233 build_linux_unsecured_with_ra false
234 elif [ $1 = 'linux_secured_with_ra' ]
236 build_linux_secured_with_ra true
237 build_linux_secured_with_ra false
238 elif [ $1 = 'linux_unsecured_with_rd' ]
240 build_linux_unsecured_with_rd true
241 build_linux_unsecured_with_rd false
242 elif [ $1 = 'linux_secured_with_rd' ]
244 build_linux_secured_with_rd true
245 build_linux_secured_with_rd false
246 elif [ $1 = 'android' ]
250 elif [ $1 = 'android_x86' ]
252 build_android_x86 true
253 build_android_x86 false
254 build_android_x86_with_rm true
255 build_android_x86_with_rm false
256 elif [ $1 = 'android_armeabi' ]
258 build_android_armeabi true
259 build_android_armeabi false
260 build_android_armeabi_with_rm true
261 build_android_armeabi_with_rm false
262 elif [ $1 = 'arduino' ]
266 elif [ $1 = 'tizen' ]
270 elif [ $1 = 'darwin' ]
274 elif [ $1 = 'unit_tests' ]
291 echo "===================== done ====================="