[IOT-2052] Update to support OCF 1.0
[iotivity.git] / auto_build.py
1 #!/usr/bin/python
2
3 import os
4 import sys
5 import platform
6 import subprocess
7 import multiprocessing
8
9 # help message
10 def helpmsg(script):
11     helpstr = '''
12 Usage:
13     build:
14         python %s <targetbuild>
15         Allowed values for <target_build>: all, linux_unsecured, linux_secured, linux_full, linux_unsecured_with_rd, linux_secured_with_rd,
16         android, android_unsecured, android_secured, tizen, tizen_unsecured, tizen_secured, simulator, darwin, windows, msys
17         Note: \"linux\" will build \"linux_unsecured\", \"linux_secured\", \"linux_secured_with_rd\", \"linux_unsecured_with_mq\", \"linux_secured_with_tcp\" & \"linux_unsecured_with_tcp\" & \"linux_unsecured_with_rd\".
18         Any selection will build both debug and release versions of all available targets in the scope you've selected.
19         To choose any specific command, please use the SCons commandline directly. Please refer to [IOTIVITY_REPO]/Readme.scons.txt.
20     clean:
21         python %s -c
22     '''
23     print (helpstr % (script, script))
24     sys.exit(1)
25
26 def call_scons(build_options, extra_option_str):
27     """
28     This function formats and runs a scons command
29     Arguments:
30     build_options    -- {Dictionary} build flags (keys) associated with values;
31     extra_option_str -- {String} extra options to append to scons command
32     """
33     cmd_line = "scons VERBOSE=" + VERBOSE
34     for key in build_options:
35         cmd_line += " " + key + "=" + str(build_options[key])
36
37     cmd_line += " " + str(extra_option_str)
38
39     if not EXEC_MODE:
40         print ("Would run : " + cmd_line)
41     else:
42         print ("Running : " + cmd_line)
43         sys.stdout.flush()
44         exit_code = subprocess.Popen(cmd_line, shell=True).wait()
45         if exit_code != 0:
46             sys.exit(exit_code)
47
48 def build_all(flag, extra_option_str):
49     if platform.system() == "Linux":
50         build_linux_unsecured(flag, extra_option_str)
51         build_linux_secured(flag, extra_option_str)
52         build_linux_unsecured_with_rm(flag, extra_option_str)
53         build_linux_unsecured_with_rd(flag, extra_option_str)
54         build_linux_secured_with_rd(flag, extra_option_str)
55         build_linux_unsecured_with_mq(flag, extra_option_str)
56         build_linux_unsecured_with_tcp(flag, extra_option_str)
57         build_linux_secured_with_tcp(flag, extra_option_str)
58         build_linux_unsecured_with_java(flag, extra_option_str)
59         build_linux_secured_with_java(flag, extra_option_str)
60         build_simulator(flag, extra_option_str)
61
62         build_android_unsecured(flag, extra_option_str)
63         build_android_secured(flag, extra_option_str)
64         build_tizen(flag, extra_option_str)
65
66     if platform.system() == "Windows":
67         build_windows(flag, extra_option_str)
68
69     if platform.system() == "Darwin":
70         build_darwin(flag, extra_option_str)
71
72 def build_linux(flag, extra_option_str):
73     build_linux_unsecured(flag, extra_option_str)
74     build_linux_secured(flag, extra_option_str)
75
76 def build_linux_unsecured(flag, extra_option_str):
77     print ("*********** Build for linux ************")
78     build_options = {
79                         'RELEASE':flag,
80                         'SECURED':0,
81                         'ERROR_ON_WARN':1,
82                     }
83     call_scons(build_options, extra_option_str)
84
85 def build_linux_secured_with_tcp(flag, extra_option_str):
86     print ("*********** Build for linux with Secured TCP ************")
87     build_options = {
88                         'RELEASE':flag,
89                         'WITH_TCP': 1,
90                         'WITH_CLOUD':1,
91                         'ERROR_ON_WARN':1,
92                     }
93     call_scons(build_options, extra_option_str)
94
95 def build_linux_unsecured_with_java(flag, extra_option_str):
96     print ("*********** Build for linux with Java support ************")
97     build_options = {
98                         'RELEASE':flag,
99                         'BUILD_JAVA': 1,
100                         'TARGET_TRANSPORT': 'IP',
101                         'ERROR_ON_WARN':1,
102                     }
103     call_scons(build_options, extra_option_str)
104
105 def build_linux_secured_with_java(flag, extra_option_str):
106     print ("*********** Build for linux with Java support and secured ************")
107     build_options = {
108                         'RELEASE':flag,
109                         'BUILD_JAVA': 1,
110                         'TARGET_TRANSPORT': 'IP',
111                         'SECURED': 1,
112                         'ERROR_ON_WARN':1,
113                     }
114     call_scons(build_options, extra_option_str)
115
116 def build_linux_unsecured_with_tcp(flag, extra_option_str):
117     print ("*********** Build for linux with TCP ************")
118     build_options = {
119                         'RELEASE':flag,
120                         'WITH_TCP': 1,
121                         'TARGET_TRANSPORT': 'IP',
122                         'SECURED':0,
123                         'ERROR_ON_WARN':1,
124                     }
125     call_scons(build_options, extra_option_str)
126
127 def build_linux_unsecured_with_rm(flag, extra_option_str):
128     print ("*********** Build for linux with RoutingManager************")
129     build_options = {
130                         'ROUTING':'GW',
131                         'RELEASE':flag,
132                         'SECURED':0,
133                         'ERROR_ON_WARN':1,
134                     }
135     call_scons(build_options, extra_option_str)
136
137 def build_linux_secured(flag, extra_option_str):
138     print ("*********** Build for linux with Security *************")
139     build_options = {
140                         'RELEASE':flag,
141                         'ERROR_ON_WARN':1,
142                     }
143     call_scons(build_options, extra_option_str)
144
145 def build_linux_full(flag, extra_option_str):
146     print ("*********** Build for linux with full features *************")
147     build_options = {
148                         'BUILD_JAVA':1,
149                         'MULTIPLE_OWNER':1,
150                         'RELEASE':flag,
151                         'SECURED':1,
152                         'WITH_CLOUD':1,
153                         'WITH_PROXY':1,
154                         'WITH_RA':1,
155                         'WITH_RA_IBB':1,
156                         'WITH_TCP':1,
157                         'ERROR_ON_WARN':1,
158                     }
159     call_scons(build_options, extra_option_str)
160
161 def build_linux_unsecured_with_rd(flag, extra_option_str):
162     print ("*********** Build for linux With Resource Directory *************")
163     build_options = {
164                         'RELEASE':flag,
165                         'RD_MODE':'all',
166                         'SECURED':0,
167                         'ERROR_ON_WARN':1,
168                     }
169     call_scons(build_options, extra_option_str)
170
171 def build_linux_secured_with_rd(flag, extra_option_str):
172     print ("*********** Build for linux With Resource Directory & Security ************")
173     build_options = {
174                         'RELEASE':flag,
175                         'RD_MODE':'all',
176                         'ERROR_ON_WARN':1,
177                     }
178     call_scons(build_options, extra_option_str)
179
180 def build_linux_unsecured_with_mq(flag, extra_option_str):
181     print ("*********** Build for linux With Message Queue ************")
182     build_options = {
183                         'RELEASE':flag,
184                         'WITH_MQ':'PUB,SUB,BROKER',
185                         'SECURED':0,
186                         'ERROR_ON_WARN':1,
187                     }
188     call_scons(build_options, extra_option_str)
189
190 def build_linux_unsecured_with_tcp(flag, extra_option_str):
191     print ("*********** Build for linux With tcp ************")
192     build_options = {
193                         'RELEASE':flag,
194                         'WITH_TCP':'1',
195                         'SECURED':0,
196                         'ERROR_ON_WARN':1,
197                     }
198     call_scons(build_options, extra_option_str)
199
200 def build_android(flag, extra_option_str):
201     # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
202     # it requires gcc-4.9, currently only android-ndk-r10(for linux)
203     # and windows android-ndk-r10(64bit target version) support these features.
204     print ("*********** Build for android armeabi *************")
205     build_options = {
206                         'TARGET_OS':'android',
207                         'TARGET_ARCH':'armeabi',
208                         'RELEASE':flag,
209                     }
210     call_scons(build_options, extra_option_str)
211
212 def build_android_universal(flag, extra_option_str):
213     print('''
214 *******************************************************************************
215     Starting Android Universal build
216     This Will take a very long time to complete. It will build the android
217     build for the following architectures.
218        - armeabi
219        - armeabi-v7a
220        - arm64-v8a
221        - x86
222        - x86_64
223     If you do not need to build a universal APK or you can target a specific
224     architecture we recommend you build android for that specific target. 
225 *******************************************************************************
226 ''')
227     print ("*********** Build for android armeabi *************")
228     build_options = {
229                         'TARGET_OS':'android',
230                         'TARGET_ARCH':'armeabi',
231                         'RELEASE':flag,
232                     }
233     call_scons(build_options, extra_option_str)
234     print ("*********** Build for android x86 *************")
235     build_options = {
236                         'TARGET_OS':'android',
237                         'TARGET_ARCH':'x86',
238                         'RELEASE':flag,
239                     }
240     call_scons(build_options, extra_option_str)
241     print ("*********** Build for android armeabi-v7a *************")
242     build_options = {
243                         'TARGET_OS':'android',
244                         'TARGET_ARCH':'armeabi-v7a',
245                         'RELEASE':flag,
246                     }
247     call_scons(build_options, extra_option_str)
248     print ("*********** Build for android x86_64 *************")
249     build_options = {
250                         'TARGET_OS':'android',
251                         'TARGET_ARCH':'x86_64',
252                         'RELEASE':flag,
253                     }
254     call_scons(build_options, extra_option_str)
255     print ("*********** Build for android arm64-v8a *************")
256     build_options = {
257                         'TARGET_OS':'android',
258                         'TARGET_ARCH':'arm64-v8a',
259                         'RELEASE':flag,
260                     }
261     call_scons(build_options, extra_option_str)
262     print ("*********** Finishing Android universal build *************")
263
264 def build_android_secured(flag, extra_option_str):
265     build_android(flag, extra_option_str + " SECURED=1")
266
267 def build_android_unsecured(flag, extra_option_str):
268     build_android(flag, extra_option_str + " SECURED=0")
269
270 def build_android_x86(flag, extra_option_str):
271     """ Build Android x86 Suite """
272     build_android_x86_with_ip(flag, extra_option_str)
273     build_android_x86_with_bt(flag, extra_option_str)
274     build_android_x86_with_ble(flag, extra_option_str)
275
276 def build_android_x86_with_ip(flag, extra_option_str):
277     print ("*********** Build for android x86 *************")
278     build_options = {
279                         'TARGET_OS':'android',
280                         'TARGET_ARCH':'x86',
281                         'RELEASE':flag,
282                         'TARGET_TRANSPORT':'IP',
283                     }
284     call_scons(build_options, extra_option_str)
285
286 def build_android_x86_with_bt(flag, extra_option_str):
287     print ("*********** Build for android x86 with Bluetooth *************")
288     build_options = {
289                         'TARGET_OS':'android',
290                         'TARGET_ARCH':'x86',
291                         'RELEASE':flag,
292                         'TARGET_TRANSPORT':'BT',
293                     }
294     call_scons(build_options, extra_option_str)
295
296 def build_android_x86_with_ble(flag, extra_option_str):
297     print ("*********** Build for android x86 with Bluetooth Low Energy *************")
298     build_options = {
299                         'TARGET_OS':'android',
300                         'TARGET_ARCH':'x86',
301                         'RELEASE':flag,
302                         'TARGET_TRANSPORT':'BLE',
303                     }
304     call_scons(build_options, extra_option_str)
305
306 def build_android_x86_with_rm(flag, extra_option_str):
307     """ Build Android x86 Routing Manager Suite """
308     build_android_x86_with_rm_and_ip(flag, extra_option_str)
309     build_android_x86_with_rm_and_bt(flag, extra_option_str)
310     build_android_x86_with_rm_and_ble(flag, extra_option_str)
311
312 def build_android_x86_with_rm_and_ip(flag, extra_option_str):
313     print ("*********** Build for android x86 with Routing Manager *************")
314     build_options = {
315                         'TARGET_OS':'android',
316                         'TARGET_ARCH':'x86',
317                         'ROUTING':'GW',
318                         'RELEASE':flag,
319                         'TARGET_TRANSPORT':'IP',
320                     }
321     call_scons(build_options, extra_option_str)
322
323 def build_android_x86_with_rm_and_bt(flag, extra_option_str):
324     print ("*********** Build for android x86 with Routing Manager and Bluetooth *************")
325     build_options = {
326                         'TARGET_OS':'android',
327                         'TARGET_ARCH':'x86',
328                         'ROUTING':'GW',
329                         'RELEASE':flag,
330                         'TARGET_TRANSPORT':'BT',
331                     }
332     call_scons(build_options, extra_option_str)
333
334 def build_android_x86_with_rm_and_ble(flag, extra_option_str):
335     print ("*********** Build for android x86 with Routing Manager and Bluetooth Low Energy *************")
336     build_options = {
337                         'TARGET_OS':'android',
338                         'TARGET_ARCH':'x86',
339                         'ROUTING':'GW',
340                         'RELEASE':flag,
341                         'TARGET_TRANSPORT':'BLE',
342                     }
343     call_scons(build_options, extra_option_str)
344
345 def build_android_armeabi(flag, extra_option_str):
346     """ Build Android Armeabi Suite """
347     build_android_armeabi_with_ip(flag, extra_option_str)
348     build_android_armeabi_with_bt(flag, extra_option_str)
349     build_android_armeabi_with_ble(flag, extra_option_str)
350
351 def build_android_armeabi_with_ip(flag, extra_option_str):
352     print ("*********** Build for android armeabi *************")
353     build_options = {
354                         'TARGET_OS':'android',
355                         'TARGET_ARCH':'armeabi',
356                         'RELEASE':flag,
357                         'TARGET_TRANSPORT':'IP',
358                     }
359     call_scons(build_options, extra_option_str)
360
361 def build_android_armeabi_with_bt(flag, extra_option_str):
362     print ("*********** Build for android armeabi with Bluetooth *************")
363     build_options = {
364                         'TARGET_OS':'android',
365                         'TARGET_ARCH':'armeabi',
366                         'RELEASE':flag,
367                         'TARGET_TRANSPORT':'BT',
368                     }
369     call_scons(build_options, extra_option_str)
370
371 def build_android_armeabi_with_ble(flag, extra_option_str):
372     print ("*********** Build for android armeabi with Bluetooth Low Energy *************")
373     build_options = {
374                         'TARGET_OS':'android',
375                         'TARGET_ARCH':'armeabi',
376                         'RELEASE':flag,
377                         'TARGET_TRANSPORT':'BLE',
378                     }
379     call_scons(build_options, extra_option_str)
380
381 def build_android_armeabi_with_rm(flag, extra_option_str):
382     """ Build Android Armeabi Routing Manager Suite """
383     build_android_armeabi_with_rm_and_ip(flag, extra_option_str)
384     build_android_armeabi_with_rm_and_bt(flag, extra_option_str)
385     build_android_armeabi_with_rm_and_ble(flag, extra_option_str)
386
387 def build_android_armeabi_with_rm_and_ip(flag, extra_option_str):
388     print ("*********** Build for android armeabi with Routing Manager *************")
389     build_options = {
390                         'TARGET_OS':'android',
391                         'TARGET_ARCH':'armeabi',
392                         'ROUTING':'GW',
393                         'RELEASE':flag,
394                         'TARGET_TRANSPORT':'IP',
395                     }
396     call_scons(build_options, extra_option_str)
397
398 def build_android_armeabi_with_rm_and_bt(flag, extra_option_str):
399     print ("*********** Build for android armeabi with Routing Manager and Bluetooth *************")
400     build_options = {
401                         'TARGET_OS':'android',
402                         'TARGET_ARCH':'armeabi',
403                         'ROUTING':'GW',
404                         'RELEASE':flag,
405                         'TARGET_TRANSPORT':'BT',
406                     }
407     call_scons(build_options, extra_option_str)
408
409 def build_android_armeabi_with_rm_and_ble(flag, extra_option_str):
410     print ("*********** Build for android armeabi with Routing Manager and Bluetooth Low Energy *************")
411     build_options = {
412                         'TARGET_OS':'android',
413                         'TARGET_ARCH':'armeabi',
414                         'ROUTING':'GW',
415                         'RELEASE':flag,
416                         'TARGET_TRANSPORT':'BLE',
417                     }
418     call_scons(build_options, extra_option_str)
419
420 def build_tizen(flag, extra_option_str):
421     print ("*********** Build for Tizen with options *************")
422     cmd_line = os.getcwd() + "/gbsbuild.sh" + " " + extra_option_str
423     if not EXEC_MODE:
424         print ("Would run : " + cmd_line)
425     else:
426         print ("Running : " + cmd_line)
427         exit_code = subprocess.Popen([cmd_line], shell=True).wait()
428         if exit_code != 0:
429             sys.exit(exit_code)
430
431     print ("*********** Build for Tizen octbstack lib and sample *************")
432     build_extra_options = "-f resource/csdk/stack/samples/tizen/build/SConscript " + extra_option_str
433     build_options = {
434                         'TARGET_OS':'tizen',
435                         'TARGET_TRANSPORT':'IP',
436                         'LOGGING':'true',
437                         'RELEASE':flag,
438                     }
439     call_scons(build_options, build_extra_options)
440
441     print ("*********** Build for Tizen octbstack lib and sample with Routing Manager*************")
442     build_options['ROUTING'] = 'GW'
443     call_scons(build_options, build_extra_options)
444
445     print ("*********** Build for Tizen Easy-Setup  sample *************")
446     build_options['ROUTING'] = 'EP'
447     build_options['ES_TARGET_ENROLLEE'] = 'tizen'
448     build_extra_options = "-f service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript " + extra_option_str
449     call_scons(build_options, build_extra_options)
450
451 def build_tizen_secured(flag, extra_option_str):
452     build_tizen(flag, extra_option_str + " SECURED=1")
453
454 def build_tizen_unsecured(flag, extra_option_str):
455     build_tizen(flag, extra_option_str + " SECURED=0")
456
457 # Mac OS and iOS
458 def build_darwin(flag, extra_option_str):
459     print ("*********** Build for OSX *************")
460     build_options = {
461                         'TARGET_OS':'darwin',
462                         'SYS_VERSION':'10.9',
463                         'RELEASE':flag,
464                     }
465     call_scons(build_options, extra_option_str)
466
467     print ("*********** Build for IOS i386 *************")
468     build_options = {
469                         'TARGET_OS':'ios',
470                         'TARGET_ARCH':'i386',
471                         'SYS_VERSION':'7.0',
472                         'RELEASE':flag,
473                     }
474     call_scons(build_options, extra_option_str)
475
476     print ("*********** Build for IOS x86_64 *************")
477     build_options['TARGET_ARCH'] = 'x86_64'
478     call_scons(build_options, extra_option_str)
479
480     print ("*********** Build for IOS armv7 *************")
481     build_options['TARGET_ARCH'] = 'armv7'
482     call_scons(build_options, extra_option_str)
483
484     print ("*********** Build for IOS armv7s *************")
485     build_options['TARGET_ARCH'] = 'armv7s'
486     call_scons(build_options, extra_option_str)
487
488     print ("*********** Build for IOS arm64 *************")
489     build_options['TARGET_ARCH'] = 'arm64'
490     call_scons(build_options, extra_option_str)
491
492 # Windows
493 def build_windows(flag, extra_option_str):
494     print ("*********** Build for Windows *************")
495     os.environ["SCONSFLAGS"] = ""
496     build_options = {
497                         'TARGET_OS':'windows',
498                         'TARGET_ARCH':'amd64',
499                         'RELEASE':flag,
500                         'TARGET_TRANSPORT':'IP',
501                         'WITH_TCP':0,
502                         'BUILD_SAMPLE':'ON',
503                         'LOGGING':'off',
504                         'TEST':1,
505                         'RD_MODE':'all',
506                     }
507     call_scons(build_options, extra_option_str)
508
509 # Windows msys
510 def build_msys(flag, extra_option_str):
511     print ("*********** Build for msys_nt *************")
512     os.environ["SCONSFLAGS"] = ""
513     build_options = {
514                         'TARGET_OS':'msys_nt',
515                         'TARGET_ARCH':'x86_64',
516                         'RELEASE':flag,
517                         'TARGET_TRANSPORT':'IP',
518                         'WITH_TCP':0,
519                         'BUILD_SAMPLE':'ON',
520                         'LOGGING':'off',
521                         'TEST':1,
522                         'RD_MODE':'all',
523                     }
524     call_scons(build_options, extra_option_str)
525
526 def build_simulator(flag, extra_option_str):
527     print ("*********** Build for simulator plugin *************")
528     build_options = {
529                         'SIMULATOR':1,
530                         'RELEASE':flag,
531                         'SECURED':0,
532                         'TARGET_TRANSPORT':'IP',
533                     }
534     call_scons(build_options, extra_option_str)
535
536 def unit_tests():
537     print ("*********** Unit test Start *************")
538     build_options = {
539                         'RELEASE':'false',
540                     }
541     extra_option_str = "-c ."
542     call_scons(build_options, extra_option_str)
543
544     build_options = {
545                         'TEST':1,
546                         'RELEASE':'false',
547                         'SECURED':0,
548                     }
549     extra_option_str = ""
550     call_scons(build_options, extra_option_str)
551
552     build_options = {
553                         'TEST':1,
554                         'SECURED':1,
555                         'RELEASE':'false',
556                     }
557     call_scons(build_options, extra_option_str)
558
559     print ("*********** Unit test Stop *************")
560
561 # Main module starts here
562 if os.getenv("SCONSFLAGS", "") == "":
563     os.environ["SCONSFLAGS"] = "-Q -j " + str(multiprocessing.cpu_count())
564
565 arg_num     = len(sys.argv)
566 script_name = sys.argv[0]
567
568 # May be overridden in user's shell
569 VERBOSE = os.getenv("VERBOSE", "1")
570 EXEC_MODE = os.getenv("EXEC_MODE", True)
571 if EXEC_MODE in ['false', 'False', '0']:
572     EXEC_MODE = False
573
574 if arg_num == 1:
575     build_all("true", "")
576     build_all("false", "")
577     unit_tests()
578
579 elif arg_num == 2:
580     if str(sys.argv[1]) == '-c':
581         build_all("true", "-c")
582         build_all("false", "-c")
583
584     elif str(sys.argv[1]) == "all":
585         build_all("true", "")
586         build_all("false", "")
587         unit_tests()
588
589     elif str(sys.argv[1]) == "linux":
590         build_linux("true", "")
591         build_linux("false", "")
592
593     elif str(sys.argv[1]) == "linux_unsecured":
594         build_linux_unsecured("true", "")
595         build_linux_unsecured("false", "")
596         build_linux_unsecured_with_rm("true", "")
597         build_linux_unsecured_with_rm("false", "")
598
599     elif str(sys.argv[1]) == "linux_secured":
600         build_linux_secured("true", "")
601         build_linux_secured("false", "")
602
603     elif str(sys.argv[1]) == "linux_full":
604         build_linux_full("true", "")
605         build_linux_full("false", "")
606
607     elif str(sys.argv[1]) == "linux_unsecured_with_rd":
608         build_linux_unsecured_with_rd("true", "")
609         build_linux_unsecured_with_rd("false", "")
610
611     elif str(sys.argv[1]) == "linux_secured_with_rd":
612         build_linux_secured_with_rd("true", "")
613         build_linux_secured_with_rd("false", "")
614
615     elif str(sys.argv[1]) == "linux_unsecured_with_mq":
616         build_linux_unsecured_with_mq("true", "")
617         build_linux_unsecured_with_mq("false", "")
618
619     elif str(sys.argv[1]) == "linux_unsecured_with_tcp":
620         build_linux_unsecured_with_tcp("true", "")
621         build_linux_unsecured_with_tcp("false", "")
622
623     elif str(sys.argv[1]) == "linux_secured_with_tcp":
624         build_linux_secured_with_tcp("false", "")
625         build_linux_secured_with_tcp("true", "")
626
627     elif str(sys.argv[1]) == "linux_unsecured_with_java":
628         build_linux_unsecured_with_java("false", "")
629         build_linux_unsecured_with_java("true", "")
630
631     elif str(sys.argv[1]) == "linux_secured_with_java":
632         build_linux_secured_with_java("false", "")
633         build_linux_secured_with_java("true", "")
634
635     elif str(sys.argv[1]) == "android":
636         build_android("true", "")
637         build_android("false", "")
638
639     elif str(sys.argv[1]) == "android_universal":
640         # only build the release version due to long amount of time to build.
641         build_android_universal("true", "")
642
643     elif str(sys.argv[1]) == "android_universal_unsecured":
644         # only build the release version due to long amount of time to build.
645         build_android_universal("true", "SECURED=0")
646
647     elif str(sys.argv[1]) == "android_unsecured":
648         build_android_unsecured("true", "")
649         build_android_unsecured("false", "")
650
651     elif str(sys.argv[1]) == "android_secured":
652         build_android_secured("true", "")
653         build_android_secured("false", "")
654
655     elif str(sys.argv[1]) == "android_x86":
656         build_android_x86("true", "")
657         build_android_x86("false", "")
658         build_android_x86_with_rm("true", "")
659         build_android_x86_with_rm("false", "")
660
661     elif str(sys.argv[1]) == "android_x86_with_ip":
662         build_android_x86_with_ip("true", "")
663         build_android_x86_with_ip("false", "")
664
665     elif str(sys.argv[1]) == "android_x86_with_bt":
666         build_android_x86_with_bt("true", "")
667         build_android_x86_with_bt("false", "")
668
669     elif str(sys.argv[1]) == "android_x86_with_ble":
670         build_android_x86_with_ble("true", "")
671         build_android_x86_with_ble("false", "")
672
673     elif str(sys.argv[1]) == "android_x86_with_rm_and_ip":
674         build_android_x86_with_rm_and_ip("true", "")
675         build_android_x86_with_rm_and_ip("false", "")
676
677     elif str(sys.argv[1]) == "android_x86_with_rm_and_bt":
678         build_android_x86_with_rm_and_bt("true", "")
679         build_android_x86_with_rm_and_bt("false", "")
680
681     elif str(sys.argv[1]) == "android_x86_with_rm_and_ble":
682         build_android_x86_with_rm_and_ble("true", "")
683         build_android_x86_with_rm_and_ble("false", "")
684
685     elif str(sys.argv[1]) == "android_armeabi":
686         build_android_armeabi("true", "")
687         build_android_armeabi("false", "")
688         build_android_armeabi_with_rm("true", "")
689         build_android_armeabi_with_rm("false", "")
690
691     elif str(sys.argv[1]) == "android_armeabi_with_ip":
692         build_android_armeabi_with_ip("true", "")
693         build_android_armeabi_with_ip("false", "")
694
695     elif str(sys.argv[1]) == "android_armeabi_with_bt":
696         build_android_armeabi_with_bt("true", "")
697         build_android_armeabi_with_bt("false", "")
698
699     elif str(sys.argv[1]) == "android_armeabi_with_ble":
700         build_android_armeabi_with_ble("true", "")
701         build_android_armeabi_with_ble("false", "")
702
703     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ip":
704         build_android_armeabi_with_rm_and_ip("true", "")
705         build_android_armeabi_with_rm_and_ip("false", "")
706
707     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_bt":
708         build_android_armeabi_with_rm_and_bt("true", "")
709         build_android_armeabi_with_rm_and_bt("false", "")
710
711     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ble":
712         build_android_armeabi_with_rm_and_ble("true", "")
713         build_android_armeabi_with_rm_and_ble("false", "")
714
715     elif str(sys.argv[1]) == "windows":
716         build_windows("true", "")
717         build_windows("false", "")
718
719     elif str(sys.argv[1]) == "msys":
720         build_msys("true", "")
721         build_msys("false", "")
722
723     elif str(sys.argv[1]) == "tizen":
724         build_tizen("true", "")
725         build_tizen("false", "")
726
727     elif str(sys.argv[1]) == "tizen_unsecured":
728         build_tizen_unsecured("true", "")
729         build_tizen_unsecured("false", "")
730
731     elif str(sys.argv[1]) == "tizen_secured":
732         build_tizen_secured("true", "")
733         build_tizen_secured("false", "")
734
735     elif str(sys.argv[1]) == "simulator":
736         build_simulator("true", "")
737         build_simulator("false", "")
738
739     elif str(sys.argv[1]) == "darwin":
740         build_darwin("true", "")
741         build_darwin("false", "")
742
743     elif str(sys.argv[1]) == "unit_tests":
744         unit_tests()
745
746     else:
747         helpmsg(script_name)
748 else:
749         helpmsg(script_name)
750
751 print ("===================== done =====================")