Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / resource / csdk / connectivity / SConscript
1 ##
2 # CA build script
3 ##
4
5 Import('env')
6
7 target_os = env.get('TARGET_OS')
8 transport = env.get('TARGET_TRANSPORT')
9 build_sample = env.get('BUILD_SAMPLE')
10 with_ra = env.get('WITH_RA')
11
12 print "Given Transport is %s" % transport
13 print "Given OS is %s" % target_os
14 print "BUILD_SAMPLE is %s" % build_sample
15
16 targets_disallow_multitransport = ['arduino']
17
18 if target_os in targets_disallow_multitransport:
19     if ('ALL' in transport) or (len(transport) != 1):
20         print "*** Error invalid option values: TARGET_TRANSPORT"
21         print "%s disallowed until testing can validate use of multiple transports on %s %d" % (transport, target_os, len(transport))
22         Exit(1)
23
24 if 'ALL' in transport:
25         if with_ra == True:
26                         env.AppendUnique(CPPDEFINES = ['RA_ADAPTER'])
27         if target_os == 'linux':
28                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','NO_LE_ADAPTER'])
29         elif target_os == 'tizen':
30                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER'])
31         elif target_os in['darwin','ios']:
32                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','NO_LE_ADAPTER'])
33         else:
34                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER'])
35         print "CA Transport is ALL"
36 else:
37         if 'BT' in transport:
38                 if target_os == 'linux':
39                         print "CA Transport BT is not supported in Linux"
40                         Exit(1)
41                 else:
42                         env.AppendUnique(CPPDEFINES = ['EDR_ADAPTER'])
43                         print "CA Transport is BT"
44         else:
45                 env.AppendUnique(CPPDEFINES = ['NO_EDR_ADAPTER'])
46
47         if 'BLE' in transport:
48                 if target_os == 'linux':
49                         print "CA Transport BLE is not supported in Linux"
50                         Exit(1)
51                 else:
52                         env.AppendUnique(CPPDEFINES = ['LE_ADAPTER'])
53                         print "CA Transport is BLE"
54         else:
55                 env.AppendUnique(CPPDEFINES = ['NO_LE_ADAPTER'])
56
57         if 'IP' in transport:
58                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER'])
59                 print "CA Transport is IP"
60         else:
61                 env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER'])
62
63 env.SConscript('./src/SConscript')
64
65 if build_sample == 'ON':
66         if target_os in ['linux', 'arduino', 'android', 'darwin']:
67                 target_path = target_os
68                 if target_os == 'darwin':
69                         target_path = 'linux'
70                 env.SConscript('./samples/' + target_path + '/SConscript')
71