Build unit tests for IP transport only
[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     ''' build unsecured and secured, running unit tests for both.
538     This option is used by the CI system, which is a virtual machine -
539     thus it should be built with only the IP transport to avoid timeouts
540     setting up infrastructure that is not present (i.e. BT and NFC)
541     '''
542     print ("*********** Unit test Start *************")
543     build_options = {
544                         'RELEASE':'false',
545                     }
546     extra_option_str = "-c ."
547     call_scons(build_options, extra_option_str)
548
549     build_options = {
550                         'TEST':1,
551                         'RELEASE':'false',
552                         'SECURED':0,
553                         'TARGET_TRANSPORT':'IP',
554                     }
555     extra_option_str = ""
556     call_scons(build_options, extra_option_str)
557
558     build_options = {
559                         'TEST':1,
560                         'RELEASE':'false',
561                         'SECURED':1,
562                         'TARGET_TRANSPORT':'IP',
563                     }
564     call_scons(build_options, extra_option_str)
565
566     print ("*********** Unit test Stop *************")
567
568 # Main module starts here
569 if os.getenv("SCONSFLAGS", "") == "":
570     os.environ["SCONSFLAGS"] = "-Q -j " + str(multiprocessing.cpu_count())
571
572 arg_num     = len(sys.argv)
573 script_name = sys.argv[0]
574
575 # May be overridden in user's shell
576 VERBOSE = os.getenv("VERBOSE", "1")
577 EXEC_MODE = os.getenv("EXEC_MODE", True)
578 if EXEC_MODE in ['false', 'False', '0']:
579     EXEC_MODE = False
580
581 if arg_num == 1:
582     build_all("true", "")
583     build_all("false", "")
584     unit_tests()
585
586 elif arg_num == 2:
587     if str(sys.argv[1]) == '-c':
588         build_all("true", "-c")
589         build_all("false", "-c")
590
591     elif str(sys.argv[1]) == "all":
592         build_all("true", "")
593         build_all("false", "")
594         unit_tests()
595
596     elif str(sys.argv[1]) == "linux":
597         build_linux("true", "")
598         build_linux("false", "")
599
600     elif str(sys.argv[1]) == "linux_unsecured":
601         build_linux_unsecured("true", "")
602         build_linux_unsecured("false", "")
603         build_linux_unsecured_with_rm("true", "")
604         build_linux_unsecured_with_rm("false", "")
605
606     elif str(sys.argv[1]) == "linux_secured":
607         build_linux_secured("true", "")
608         build_linux_secured("false", "")
609
610     elif str(sys.argv[1]) == "linux_full":
611         build_linux_full("true", "")
612         build_linux_full("false", "")
613
614     elif str(sys.argv[1]) == "linux_unsecured_with_rd":
615         build_linux_unsecured_with_rd("true", "")
616         build_linux_unsecured_with_rd("false", "")
617
618     elif str(sys.argv[1]) == "linux_secured_with_rd":
619         build_linux_secured_with_rd("true", "")
620         build_linux_secured_with_rd("false", "")
621
622     elif str(sys.argv[1]) == "linux_unsecured_with_mq":
623         build_linux_unsecured_with_mq("true", "")
624         build_linux_unsecured_with_mq("false", "")
625
626     elif str(sys.argv[1]) == "linux_unsecured_with_tcp":
627         build_linux_unsecured_with_tcp("true", "")
628         build_linux_unsecured_with_tcp("false", "")
629
630     elif str(sys.argv[1]) == "linux_secured_with_tcp":
631         build_linux_secured_with_tcp("false", "")
632         build_linux_secured_with_tcp("true", "")
633
634     elif str(sys.argv[1]) == "linux_unsecured_with_java":
635         build_linux_unsecured_with_java("false", "")
636         build_linux_unsecured_with_java("true", "")
637
638     elif str(sys.argv[1]) == "linux_secured_with_java":
639         build_linux_secured_with_java("false", "")
640         build_linux_secured_with_java("true", "")
641
642     elif str(sys.argv[1]) == "android":
643         build_android("true", "")
644         build_android("false", "")
645
646     elif str(sys.argv[1]) == "android_universal":
647         # only build the release version due to long amount of time to build.
648         build_android_universal("true", "")
649
650     elif str(sys.argv[1]) == "android_universal_unsecured":
651         # only build the release version due to long amount of time to build.
652         build_android_universal("true", "SECURED=0")
653
654     elif str(sys.argv[1]) == "android_unsecured":
655         build_android_unsecured("true", "")
656         build_android_unsecured("false", "")
657
658     elif str(sys.argv[1]) == "android_secured":
659         build_android_secured("true", "")
660         build_android_secured("false", "")
661
662     elif str(sys.argv[1]) == "android_x86":
663         build_android_x86("true", "")
664         build_android_x86("false", "")
665         build_android_x86_with_rm("true", "")
666         build_android_x86_with_rm("false", "")
667
668     elif str(sys.argv[1]) == "android_x86_with_ip":
669         build_android_x86_with_ip("true", "")
670         build_android_x86_with_ip("false", "")
671
672     elif str(sys.argv[1]) == "android_x86_with_bt":
673         build_android_x86_with_bt("true", "")
674         build_android_x86_with_bt("false", "")
675
676     elif str(sys.argv[1]) == "android_x86_with_ble":
677         build_android_x86_with_ble("true", "")
678         build_android_x86_with_ble("false", "")
679
680     elif str(sys.argv[1]) == "android_x86_with_rm_and_ip":
681         build_android_x86_with_rm_and_ip("true", "")
682         build_android_x86_with_rm_and_ip("false", "")
683
684     elif str(sys.argv[1]) == "android_x86_with_rm_and_bt":
685         build_android_x86_with_rm_and_bt("true", "")
686         build_android_x86_with_rm_and_bt("false", "")
687
688     elif str(sys.argv[1]) == "android_x86_with_rm_and_ble":
689         build_android_x86_with_rm_and_ble("true", "")
690         build_android_x86_with_rm_and_ble("false", "")
691
692     elif str(sys.argv[1]) == "android_armeabi":
693         build_android_armeabi("true", "")
694         build_android_armeabi("false", "")
695         build_android_armeabi_with_rm("true", "")
696         build_android_armeabi_with_rm("false", "")
697
698     elif str(sys.argv[1]) == "android_armeabi_with_ip":
699         build_android_armeabi_with_ip("true", "")
700         build_android_armeabi_with_ip("false", "")
701
702     elif str(sys.argv[1]) == "android_armeabi_with_bt":
703         build_android_armeabi_with_bt("true", "")
704         build_android_armeabi_with_bt("false", "")
705
706     elif str(sys.argv[1]) == "android_armeabi_with_ble":
707         build_android_armeabi_with_ble("true", "")
708         build_android_armeabi_with_ble("false", "")
709
710     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ip":
711         build_android_armeabi_with_rm_and_ip("true", "")
712         build_android_armeabi_with_rm_and_ip("false", "")
713
714     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_bt":
715         build_android_armeabi_with_rm_and_bt("true", "")
716         build_android_armeabi_with_rm_and_bt("false", "")
717
718     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ble":
719         build_android_armeabi_with_rm_and_ble("true", "")
720         build_android_armeabi_with_rm_and_ble("false", "")
721
722     elif str(sys.argv[1]) == "windows":
723         build_windows("true", "")
724         build_windows("false", "")
725
726     elif str(sys.argv[1]) == "msys":
727         build_msys("true", "")
728         build_msys("false", "")
729
730     elif str(sys.argv[1]) == "tizen":
731         build_tizen("true", "")
732         build_tizen("false", "")
733
734     elif str(sys.argv[1]) == "tizen_unsecured":
735         build_tizen_unsecured("true", "")
736         build_tizen_unsecured("false", "")
737
738     elif str(sys.argv[1]) == "tizen_secured":
739         build_tizen_secured("true", "")
740         build_tizen_secured("false", "")
741
742     elif str(sys.argv[1]) == "simulator":
743         build_simulator("true", "")
744         build_simulator("false", "")
745
746     elif str(sys.argv[1]) == "darwin":
747         build_darwin("true", "")
748         build_darwin("false", "")
749
750     elif str(sys.argv[1]) == "unit_tests":
751         unit_tests()
752
753     else:
754         helpmsg(script_name)
755 else:
756         helpmsg(script_name)
757
758 print ("===================== done =====================")