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
23 if [ $(uname -s) = "Darwin" ]
29 function build_linux()
31 build_linux_unsecured $1 $2
33 build_linux_secured $1 $2
36 function build_linux_unsecured()
38 echo "*********** Build for linux ************"
42 function build_linux_secured()
44 echo "*********** Build for linux with Security *************"
45 scons RELEASE=$1 SECURED=1 $2
48 function build_linux_unsecured_with_ra()
51 echo "*********** Build for linux With Remote Access *************"
52 scons RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 $2
55 function build_linux_secured_with_ra()
57 echo "*********** Build for linux With Remote Access & Security ************"
58 scons RELEASE=$1 WITH_RA=1 WITH_RA_IBB=1 SECURED=1 $2
61 function build_android()
63 # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
64 # it requires gcc-4.9, currently only android-ndk-r10(for linux)
65 # and windows android-ndk-r10(64bit target version) support these features.
67 build_android_x86 $1 $2
68 build_android_armeabi $1 $2
71 function build_android_x86()
73 echo "*********** Build for android x86 *************"
74 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=IP $2
75 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BT $2
76 scons TARGET_OS=android TARGET_ARCH=x86 RELEASE=$1 TARGET_TRANSPORT=BLE $2
79 function build_android_armeabi()
81 echo "*********** Build for android armeabi *************"
82 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=IP $2
83 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BT $2
84 scons TARGET_OS=android TARGET_ARCH=armeabi RELEASE=$1 TARGET_TRANSPORT=BLE $2
87 function build_arduino()
89 echo "*********** Build for arduino avr *************"
90 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
91 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
92 scons resource TARGET_OS=arduino UPLOAD=false BOARD=mega TARGET_ARCH=avr TARGET_TRANSPORT=BLE SHIELD=RBL_NRF8001 RELEASE=$1 $2
94 echo "*********** Build for arduino arm *************"
95 scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=ETH RELEASE=$1 $2
96 scons resource TARGET_OS=arduino UPLOAD=false BOARD=arduino_due_x TARGET_ARCH=arm TARGET_TRANSPORT=IP SHIELD=WIFI RELEASE=$1 $2
97 # BLE support for the Arduino Due is currently unavailable.
100 function build_tizen()
102 echo "*********** Build for Tizen *************"
105 echo "*********** Build for Tizen CA lib and sample *************"
106 scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
108 echo "*********** Build for Tizen CA lib and sample with Security *************"
109 scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true SECURED=1 RELEASE=$1 $2
112 function build_darwin() # Mac OSx and iOS
114 echo "*********** Build for OSX *************"
115 scons TARGET_OS=darwin SYS_VERSION=10.9 RELEASE=$1 $2
117 echo "*********** Build for IOS i386 *************"
118 scons TARGET_OS=ios TARGET_ARCH=i386 SYS_VERSION=7.0 RELEASE=$1 $2
120 echo "*********** Build for IOS x86_64 *************"
121 scons TARGET_OS=ios TARGET_ARCH=x86_64 SYS_VERSION=7.0 RELEASE=$1 $2
123 echo "*********** Build for IOS armv7 *************"
124 scons TARGET_OS=ios TARGET_ARCH=armv7 SYS_VERSION=7.0 RELEASE=$1 $2
126 echo "*********** Build for IOS armv7s *************"
127 scons TARGET_OS=ios TARGET_ARCH=armv7s SYS_VERSION=7.0 RELEASE=$1 $2
129 echo "*********** Build for IOS arm64 *************"
130 scons TARGET_OS=ios TARGET_ARCH=arm64 SYS_VERSION=7.0 RELEASE=$1 $2
133 function unit_tests()
135 echo "*********** Unit test Start *************"
136 scons resource RELEASE=false -c
137 scons resource LOGGING=false RELEASE=false
138 scons resource TEST=1 RELEASE=false
139 echo "*********** Unit test Stop *************"
146 echo " `basename $0` <target_build>"
147 echo " Allowed values for <target_build>: all, linux_unsecured, linux_secured, linux_unsecured_with_ra, linux_secured_with_ra, android, arduino, tizen, darwin"
148 echo " Note: \"linux\" will build \"linux_unsecured\", \"linux_secured\", \"linux_unsecured_with_ra\" & \"linux_secured_with_ra\"."
149 echo " Any selection will build both debug and release versions of all available targets in the scope you've"
150 echo " selected. To choose any specific command, please use the SCons commandline directly. Please refer"
151 echo " to [IOTIVITY_REPO]/Readme.scons.txt."
153 echo " `basename $0` -c"
156 # Suppress "Reading ..." message and enable parallel build
157 export SCONSFLAGS="-Q -j 4"
171 elif [ $1 = 'linux' ]
175 elif [ $1 = 'linux_unsecured' ]
177 build_linux_unsecured true
178 build_linux_unsecured false
179 elif [ $1 = 'linux_secured' ]
181 build_linux_secured true
182 build_linux_secured false
183 elif [ $1 = 'linux_unsecured_with_ra' ]
185 build_linux_unsecured_with_ra true
186 build_linux_unsecured_with_ra false
187 elif [ $1 = 'linux_secured_with_ra' ]
189 build_linux_secured_with_ra true
190 build_linux_secured_with_ra false
191 elif [ $1 = 'android' ]
195 elif [ $1 = 'android_x86' ]
197 build_android_x86 true
198 build_android_x86 false
199 elif [ $1 = 'android_armeabi' ]
201 build_android_armeabi true
202 build_android_armeabi false
203 elif [ $1 = 'arduino' ]
207 elif [ $1 = 'tizen' ]
211 elif [ $1 = 'darwin' ]
215 elif [ $1 = 'unit_tests' ]
232 echo "===================== done ====================="