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