Imported Upstream version 0.9.1
[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
11 print "Given Transport is %s" % transport
12 print "Given OS is %s" % target_os
13 print "BUILD_SAMPLE is %s" % build_sample
14
15 targets_disallow_multitransport = ['arduino']
16
17 if target_os in targets_disallow_multitransport:
18     if ('ALL' in transport) or (len(transport) != 1):
19         print "*** Error invalid option values: TARGET_TRANSPORT"
20         print "%s disallowed until testing can validate use of multiple transports on %s %d" % (transport, target_os, len(transport))
21         Exit(1)
22
23 if 'ALL' in transport:
24         if target_os == 'linux':
25                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','NO_LE_ADAPTER'])
26         elif target_os == 'tizen':
27                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER'])
28         elif target_os == 'darwin':
29                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','NO_LE_ADAPTER'])
30         else:
31                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER'])
32         print "CA Transport is ALL"
33 else:
34         if 'BT' in transport:
35                 if target_os == 'linux':
36                         print "CA Transport BT is not supported in Linux"
37                         Exit(1)
38                 else:
39                         env.AppendUnique(CPPDEFINES = ['EDR_ADAPTER'])
40                         print "CA Transport is BT"
41         else:
42                 env.AppendUnique(CPPDEFINES = ['NO_EDR_ADAPTER'])
43
44         if 'BLE' in transport:
45                 if target_os == 'linux':
46                         print "CA Transport BLE is not supported in Linux"
47                         Exit(1)
48                 else:
49                         env.AppendUnique(CPPDEFINES = ['LE_ADAPTER'])
50                         print "CA Transport is BLE"
51         else:
52                 env.AppendUnique(CPPDEFINES = ['NO_LE_ADAPTER'])
53
54         if 'IP' in transport:
55                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER'])
56                 print "CA Transport is IP"
57         else:
58                 env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER'])
59
60 env.SConscript('./src/SConscript')
61
62 if build_sample == 'ON':
63         if target_os in ['linux', 'arduino', 'android']:
64                 env.SConscript('./samples/' + target_os + '/SConscript')
65