9 ca_os = env.get('TARGET_OS')
10 ca_transport = env.get('TARGET_TRANSPORT')
11 secured = env.get('SECURED')
12 with_ra = env.get ('WITH_RA')
13 with_tcp = env.get('WITH_TCP')
14 src_dir = env.get('SRC_DIR')
18 #####################################################################
19 # Source files and Target(s)
20 ######################################################################
22 print"Reading ca script %s"%ca_transport
24 env.PrependUnique(CPPPATH = [ os.path.join(root_dir, 'api') ])
25 env.AppendUnique(CPPPATH = [ os.path.join(root_dir, 'inc'),
26 os.path.join(root_dir, 'lib/libcoap-4.1.1'),
27 os.path.join(src_dir, '/resource/csdk/logger/include/'),
28 os.path.join(root_dir, 'common/inc') ])
30 if ca_os not in ['arduino', 'windows', 'winrt']:
31 env.AppendUnique(CPPDEFINES = ['WITH_POSIX'])
33 if ca_os not in ['darwin', 'ios', 'windows', 'winrt']:
34 env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
36 if ca_os in ['darwin','ios']:
37 env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
39 # Getting common source files
40 env.SConscript('./../common/SConscript')
42 # The tinydtls library is found in '#extlibs/tinydtls', where the '#'
43 # is interpreted by SCons as the top-level iotivity directory where
44 # the SConscruct file is found.
45 if env.get('SECURED') == '1':
46 if ca_os == 'tizen' and os.path.exists(root_dir + '/extlibs/tinydtls'):
47 env.SConscript(os.path.join(root_dir, 'extlibs/tinydtls/SConscript'))
49 env.SConscript('#extlibs/tinydtls/SConscript')
50 if ca_os == 'tizen' and os.path.exists(root_dir + '/extlibs/timer'):
51 env.SConscript(os.path.join(root_dir, 'extlibs/timer/SConscript'))
52 env.AppendUnique(CPPPATH = [os.path.join(root_dir, 'extlibs/timer')])
54 env.SConscript('#extlibs/timer/SConscript')
55 env.AppendUnique(CPPPATH = ['#extlibs/timer'])
57 env.AppendUnique(CA_SRC = [os.path.join(ca_path,
58 'adapter_util/caadapterutils.c')])
59 env.AppendUnique(CA_SRC = [os.path.join(ca_path,
60 'adapter_util/cafragmentation.c')])
62 if env.get('SECURED') == '1':
63 env.AppendUnique(CA_SRC = [os.path.join(ca_path,
64 'adapter_util/caadapternetdtls.c')])
65 env.AppendUnique(CPPPATH = [os.path.join(root_dir,
67 if env.get('DTLS_WITH_X509') == '1':
68 env.AppendUnique(CPPPATH = [src_dir + '/resource/csdk/connectivity/inc/pkix'])
69 env.AppendUnique(CPPPATH = [src_dir + '/extlibs/tinydtls/ecc/'])
70 env.AppendUnique(CPPPATH = [src_dir + '/extlibs/tinydtls/sha2/'])
71 env.AppendUnique(CPPDEFINES = ['__WITH_X509__'])
72 if not env.get('RELEASE'):
73 env.AppendUnique(CPPDEFINES = ['X509_DEBUG'])
74 pkix_src = Glob('adapter_util/pkix/*.c');
75 env.AppendUnique(CA_SRC = pkix_src)
79 if env.get('ROUTING') == 'GW':
80 env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
81 elif env.get('ROUTING') == 'EP':
82 env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
84 if ca_os == 'arduino':
85 env.AppendUnique(CPPDEFINES = ['SINGLE_THREAD'])
86 env.AppendUnique(CPPDEFINES = ['WITH_ARDUINO'])
87 print "setting WITH_ARDUINO"
89 'caconnectivitymanager.c',
90 'cainterfacecontroller.c',
92 'canetworkconfigurator.c',
93 'caprotocolmessage.c',
98 'caconnectivitymanager.c',
99 'cainterfacecontroller.c',
100 'camessagehandler.c',
101 'canetworkconfigurator.c',
102 'caprotocolmessage.c',
103 'caqueueingthread.c',
104 'caretransmission.c',
106 if (('BT' in ca_transport) or ('IP' in ca_transport) or ('ALL' in ca_transport)):
107 env.AppendUnique(CA_SRC = [os.path.join(ca_path, 'cablockwisetransfer.c') ])
108 env.AppendUnique(CPPDEFINES = ['WITH_BWT'])
110 env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
111 if ca_os == 'tizen' and os.path.exists(root_dir + '/extlibs/tinydtls'):
112 env.AppendUnique(CPPPATH = [os.path.join(root_dir, 'extlibs/tinydtls')])
114 env.AppendUnique(CPPPATH = ['#extlibs/tinydtls'])
117 os.path.join(ca_path, d) for d in ca_common_src ]
119 env.AppendUnique(CA_SRC = ca_common_src)
121 if 'ALL' in ca_transport:
122 transports = [ 'ip_adapter', 'bt_edr_adapter', 'bt_le_adapter']
124 transports.append ('ra_adapter')
125 env.SConscript(dirs = [
126 os.path.join(ca_path, d) for d in transports ])
128 if 'IP' in ca_transport:
129 env.SConscript(os.path.join(ca_path, 'ip_adapter/SConscript'))
131 if 'BT' in ca_transport:
132 env.SConscript(os.path.join(ca_path, 'bt_edr_adapter/SConscript'))
134 if 'BLE' in ca_transport:
135 env.SConscript(os.path.join(ca_path, 'bt_le_adapter/SConscript'))
137 if ca_os in ['linux', 'tizen', 'android']:
139 env.SConscript(os.path.join(ca_path, 'tcp_adapter/SConscript'))
140 env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
142 print "Include path is %s" % env.get('CPPPATH')
143 print "Files path is %s" % env.get('CA_SRC')
144 if ca_os in ['android', 'tizen']:
145 env.AppendUnique(LIBS = ['coap'])
146 if env.get('SECURED') == '1':
147 env.AppendUnique(LIBS = ['tinydtls'])
148 env.AppendUnique(LIBS = ['timer'])
149 if ca_os != 'android':
150 env.AppendUnique(LIBS = ['rt'])
151 calib = env.SharedLibrary('connectivity_abstraction', env.get('CA_SRC'))
153 calib = env.StaticLibrary('connectivity_abstraction', env.get('CA_SRC'))
154 env.InstallTarget(calib, 'libconnectivity_abstraction')