8 ca_os = env.get('TARGET_OS')
9 ca_transport = env.get('TARGET_TRANSPORT')
10 secured = env.get('SECURED')
11 multiple_owner = env.get('MULTIPLE_OWNER')
12 with_ra = env.get ('WITH_RA')
13 with_ra_ibb = env.get('WITH_RA_IBB')
14 with_tcp = env.get('WITH_TCP')
15 src_dir = env.get('SRC_DIR')
19 #####################################################################
20 # Source files and Target(s)
21 ######################################################################
23 print"Reading ca script %s"%ca_transport
25 env.PrependUnique(CPPPATH = [ os.path.join(root_dir, 'api') ])
27 with_upstream_libcoap = env.get('WITH_UPSTREAM_LIBCOAP')
28 if with_upstream_libcoap == '1':
29 # For bring up purposes only, we manually copy the forked version to where the unforked version is downloaded.
30 env.AppendUnique(CPPPATH = [os.path.join('#extlibs', 'libcoap', 'libcoap', 'include')])
31 env.AppendUnique(CPPDEFINES = ['WITH_UPSTREAM_LIBCOAP'])
33 # For bring up purposes only, the forked version will live here.
34 env.AppendUnique(CPPPATH = [ os.path.join(root_dir, 'lib', 'libcoap-4.1.1', 'include')])
36 env.AppendUnique(CPPPATH = [ os.path.join(root_dir, 'inc'),
37 os.path.join(src_dir, 'resource', 'csdk', 'logger', 'include'),
38 os.path.join(root_dir, 'common', 'inc'),
39 os.path.join(root_dir, 'util', 'inc') ])
41 if ca_os not in ['arduino', 'windows']:
42 env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
44 if ca_os not in ['darwin', 'ios', 'windows']:
45 env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
47 if ca_os in ['darwin','ios']:
48 env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
50 # Getting common source files
51 env.SConscript(os.path.join(root_dir, 'common', 'SConscript'))
53 # Getting util source files
54 env.SConscript(os.path.join(root_dir, 'util', 'SConscript'))
56 # The tinydtls library is found in '#extlibs/tinydtls', where the '#'
57 # is interpreted by SCons as the top-level iotivity directory where
58 # the SConscruct file is found.
59 build_dir = env.get('BUILD_DIR')
61 env.AppendUnique(CA_SRC = [os.path.join(ca_path,
62 'adapter_util/caadapterutils.c')])
64 if (('BLE' in ca_transport) or ('ALL' in ca_transport)):
65 env.AppendUnique(CA_SRC = [os.path.join(ca_path,
66 'adapter_util/cafragmentation.c')])
68 if env.get('SECURED') == '1':
69 env.SConscript(build_dir + 'extlibs/tinydtls/SConscript')
70 env.AppendUnique(CPPPATH = ['#extlibs/tinydtls'])
71 env.SConscript(build_dir + 'extlibs/timer/SConscript')
72 env.AppendUnique(CPPPATH = ['#extlibs/timer'])
73 env.AppendUnique(CPPPATH = [src_dir + '/resource/csdk/security/include'])
74 env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
75 env.AppendUnique(CPPPATH = [os.path.join(root_dir, 'external/inc')])
76 tls_path = 'extlibs/mbedtls';
77 tls_headers_path = 'mbedtls/include';
78 if ca_os == 'tizen' and os.path.exists(root_dir + '/' + tls_path):
79 env.SConscript(os.path.join(root_dir, tls_path + '/SConscript'))
80 env.AppendUnique(CPPPATH = [os.path.join(root_dir, tls_path + '/' + tls_headers_path)])
82 if ca_os != 'android':
83 env.SConscript('#' + tls_path + '/SConscript')
84 env.AppendUnique(CPPPATH = ['#' + tls_path + '/' + tls_headers_path])
85 env.AppendUnique(CA_SRC = [os.path.join(ca_path, 'adapter_util/ca_adapter_net_ssl.c')])
87 if ((secured == '1') and (with_tcp == True)):
88 env.AppendUnique(CPPDEFINES = ['__WITH_TLS__'])
90 if (multiple_owner == '1'):
91 env.AppendUnique(CPPDEFINES=['_ENABLE_MULTIPLE_OWNER_'])
97 env.SConscript('#extlibs/wksxmppxep/SConscript')
99 if env.get('ROUTING') == 'GW':
100 env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
101 elif env.get('ROUTING') == 'EP':
102 env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
104 if env.get('WITH_PROXY'):
105 env.AppendUnique(CPPDEFINES = ['WITH_CHPROXY'])
107 if ca_os == 'arduino':
108 env.AppendUnique(CPPDEFINES = ['SINGLE_THREAD'])
109 env.AppendUnique(CPPDEFINES = ['WITH_ARDUINO'])
110 print "setting WITH_ARDUINO"
112 'caconnectivitymanager.c',
113 'cainterfacecontroller.c',
114 'camessagehandler.c',
115 'canetworkconfigurator.c',
116 'caprotocolmessage.c',
117 'caretransmission.c',
121 'caconnectivitymanager.c',
122 'cainterfacecontroller.c',
123 'camessagehandler.c',
124 'canetworkconfigurator.c',
125 'caprotocolmessage.c',
126 'caqueueingthread.c',
127 'caretransmission.c',
129 if (('IP' in ca_transport) or ('ALL' in ca_transport)):
130 env.AppendUnique(CA_SRC = [os.path.join(ca_path, 'cablockwisetransfer.c') ])
131 env.AppendUnique(CPPDEFINES = ['WITH_BWT'])
134 os.path.join(ca_path, d) for d in ca_common_src ]
136 env.AppendUnique(CA_SRC = ca_common_src)
138 if 'ALL' in ca_transport:
142 transports.append('ra_adapter')
144 if ca_os in ['linux']:
145 transports.append('ip_adapter')
146 transports.append('bt_le_adapter')
147 elif ca_os in ['tizen']:
148 transports.append('ip_adapter')
149 transports.append('bt_edr_adapter')
150 transports.append('bt_le_adapter')
151 elif ca_os in ['android']:
152 transports.append('ip_adapter')
153 transports.append('bt_edr_adapter')
154 transports.append('bt_le_adapter')
155 transports.append('nfc_adapter')
156 elif ca_os in['darwin','ios', 'msys_nt', 'windows']:
157 transports.append('ip_adapter')
159 transports.append('ip_adapter')
160 transports.append('bt_edr_adapter')
161 transports.append('bt_le_adapter')
163 env.SConscript(dirs = [
164 os.path.join(ca_path, d) for d in transports ])
166 if 'IP' in ca_transport:
167 env.SConscript(os.path.join(ca_path, 'ip_adapter/SConscript'))
168 if ca_os == 'arduino':
170 transports = [ 'ip_adapter', 'tcp_adapter']
171 env.SConscript(dirs = [
172 os.path.join(ca_path, d) for d in transports ])
174 if 'BT' in ca_transport:
175 env.SConscript(os.path.join(ca_path, 'bt_edr_adapter/SConscript'))
177 if 'BLE' in ca_transport:
178 env.SConscript(os.path.join(ca_path, 'bt_le_adapter/SConscript'))
180 if 'NFC' in ca_transport:
181 env.SConscript(os.path.join(ca_path, 'nfc_adapter/SConscript'))
183 if ca_os in ['linux', 'tizen', 'android']:
185 env.SConscript(os.path.join(ca_path, 'tcp_adapter/SConscript'))
186 env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
188 if ca_os in ['linux', 'tizen', 'android', 'arduino', 'ios']:
189 if (('BLE' in ca_transport) or ('BT' in ca_transport) or ('ALL' in ca_transport)):
190 env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
192 print "Include path is %s" % env.get('CPPPATH')
193 print "Files path is %s" % env.get('CA_SRC')
195 lib_env = env.Clone()
196 lib_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
198 if env.get('LOGGING'):
199 lib_env.AppendUnique(CPPDEFINES=['TB_LOG'])
201 if ca_os == 'android':
202 lib_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libconnectivity_abstraction.so'])
204 if ca_os in ['android', 'tizen', 'linux']:
205 lib_env.AppendUnique(LIBS = ['coap'])
206 if lib_env.get('SECURED') == '1':
207 lib_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
208 lib_env.AppendUnique(LIBS = ['timer'])
209 if ca_os != 'android':
210 lib_env.AppendUnique(LIBS = ['rt'])
211 if ((lib_env.get('SECURED') == '1') and ((lib_env.get('WITH_TCP')) or (lib_env.get('WITH_CLOUD')))):
212 lib_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
213 lib_env.AppendUnique(LIBS = ['timer'])
214 static_calib = lib_env.StaticLibrary('connectivity_abstraction', env.get('CA_SRC'))
215 shared_calib = lib_env.SharedLibrary('connectivity_abstraction', lib_env.get('CA_SRC'))
216 calib = Flatten([static_calib, shared_calib])
217 elif ca_os in ['msys_nt', 'windows']:
218 lib_env.AppendUnique(LIBS = ['coap', 'mswsock', 'ws2_32', 'iphlpapi', 'logger'])
219 if lib_env.get('SECURED') == '1':
220 lib_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
221 lib_env.AppendUnique(LIBS = ['timer'])
222 calib = lib_env.StaticLibrary('connectivity_abstraction', env.get('CA_SRC'))
224 calib = lib_env.StaticLibrary('connectivity_abstraction', lib_env.get('CA_SRC'))
226 lib_env.InstallTarget(calib, 'connectivity_abstraction')
227 lib_env.UserInstallTargetLib(calib, 'connectivity_abstraction')