[CONPRO-1473] Fix for build error [-Werror=implicit-function-declaration]
[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 with_tcp = env.get('WITH_TCP')
12 disable_tcp_server = env.get('DISABLE_TCP_SERVER')
13 disable_ble_server = env.get('DISABLE_BLE_SERVER')
14 with_mq = env.get('WITH_MQ')
15 ble_custom_adv = env.get('BLE_CUSTOM_ADV')
16
17 print "Given Transport is %s" % transport
18 print "Given OS is %s" % target_os
19 print "BUILD_SAMPLE is %s" % build_sample
20 print "MQ flag is %s" % with_mq
21
22 targets_disallow_multitransport = ['arduino']
23
24 if target_os in targets_disallow_multitransport:
25     if ('ALL' in transport) or (len(transport) != 1):
26         print "*** Error invalid option values: TARGET_TRANSPORT"
27         print "%s disallowed until testing can validate use of multiple transports on %s %d" % (transport, target_os, len(transport))
28         Exit(1)
29
30 if 'ALL' in transport:
31         if with_ra == True:
32                         env.AppendUnique(CPPDEFINES = ['RA_ADAPTER'])
33         if with_tcp == True:
34                         env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER'])
35         if disable_tcp_server == True:
36                         env.AppendUnique(CPPDEFINES = ['DISABLE_TCP_SERVER'])
37         if disable_ble_server == True:
38                 if target_os in ['tizen']:
39                         env.AppendUnique(CPPDEFINES = ['DISABLE_BLE_SERVER'])
40         if target_os in ['linux']:
41                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','LE_ADAPTER'])
42         elif target_os == 'tizen':
43                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER'])
44         elif target_os == 'android':
45                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER', 'NFC_ADAPTER'])
46         elif target_os in['darwin','ios']:
47                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','NO_LE_ADAPTER'])
48         elif target_os in ['msys_nt', 'windows']:
49                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','NO_LE_ADAPTER'])
50         else:
51                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER'])
52         print "CA Transport is ALL"
53 else:
54         if 'BT' in transport:
55                 if target_os in ['linux']:
56                         print "CA Transport BT is not supported in Linux"
57                         Exit(1)
58                 else:
59                         env.AppendUnique(CPPDEFINES = ['EDR_ADAPTER'])
60                         print "CA Transport is BT"
61         else:
62                 env.AppendUnique(CPPDEFINES = ['NO_EDR_ADAPTER'])
63
64         if 'BLE' in transport:
65                 env.AppendUnique(CPPDEFINES = ['LE_ADAPTER'])
66                 print "CA Transport is BLE"
67                 if ble_custom_adv in ['True']:
68                         env.AppendUnique(CPPDEFINES = ['BLE_CUSTOM_ADVERTISE'])
69                         print "BLE Custom advertisement supported"
70                 else:
71                         print "BLE Custom advertisement not supported"
72                 if disable_ble_server == True:
73                         if target_os in ['tizen']:
74                                 env.AppendUnique(CPPDEFINES = ['DISABLE_BLE_SERVER'])
75                                 print "BLE Server Disabled"
76         else:
77                 env.AppendUnique(CPPDEFINES = ['NO_LE_ADAPTER'])
78
79         if 'IP' in transport:
80                 env.AppendUnique(CPPDEFINES = ['IP_ADAPTER'])
81                 print "CA Transport is IP"
82         else:
83                 env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER'])
84
85         if with_tcp == True:
86                 if target_os in ['linux', 'tizen', 'android', 'arduino', 'ios', 'tizenrt']:
87                         env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER', 'WITH_TCP'])
88                         print "CA Transport is TCP"
89                 else:
90                         print "CA Transport TCP is not supported "
91                         Exit(1)
92         else:
93                 env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
94
95         if disable_tcp_server == True:
96                 if target_os in ['linux', 'tizen', 'android', 'arduino', 'ios', 'tizenrt']:
97                         env.AppendUnique(CPPDEFINES = ['DISABLE_TCP_SERVER'])
98
99         if 'NFC' in transport:
100                 if target_os in['android']:
101                         env.AppendUnique(CPPDEFINES = ['NFC_ADAPTER'])
102                         print "CA Transport is NFC"
103                 else:
104                         print "CA Transport NFC is not supported "
105                         Exit(1)
106         else:
107                 env.AppendUnique(CPPDEFINES = ['NO_NFC_ADAPTER'])
108
109 if 'SUB' in with_mq:
110         env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
111         print "MQ SUB support"
112
113 if 'PUB' in with_mq:
114         env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
115         print "MQ PUB support"
116
117 if 'BROKER' in with_mq:
118         env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
119         print "MQ Broker support"
120
121 env.SConscript('./src/SConscript')