Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / ip_adapter / SConscript
1 #######################################################
2 #       Build IP adapter
3 #######################################################
4
5 Import('env')
6 import os.path
7
8 print("Reading IP adapter script")
9
10 target_os = env.get('TARGET_OS')
11 inc_files = env.get('CPPPATH')
12 secured = env.get('SECURED')
13 src_dir = './ip_adapter/'
14
15
16 # Source files to build common for all platforms
17 common_files = None
18 if target_os == 'arduino':
19     common_files = [ os.path.join(src_dir,
20                                   'caipadapter.c') ]
21 else:
22     common_files = [
23         os.path.join(src_dir, 'caipadapter.c'),
24         os.path.join(src_dir, 'caipserver.c'),
25         os.path.join(src_dir, 'caipnwmonitor_common.c') ]
26
27 env.AppendUnique(CPPPATH = [ src_dir ])
28
29 # Get list of target-specific source file base names, i.e. no parent
30 # directories prepended to the path.
31 #
32 # Target-specific SConscript files are expected to return that list.
33 target_files = []
34 target_sconscript = os.path.join(target_os, 'SConscript')
35
36 # Check for the existence of the platform-specific SConscript file
37 # relative to the top-level source directory, not the build (variant)
38 # directory, before calling that SConscript file to prevent a missing
39 # file warning platforms that don't provide one.
40 target_sconscript_abspath = str(File(target_sconscript).srcnode().abspath)
41 if os.path.exists(target_sconscript_abspath):
42         target_files = env.SConscript(target_sconscript, exports='src_dir')
43
44 # Now prepend the appropriate parent directories
45 # (e.g. ./ip_adapter/android) to each of the target source files in
46 # the list.
47 target_files = [ os.path.join(src_dir, target_os, f) for f in target_files ]
48
49 # Source files to build for Linux-like platforms
50 if target_os in ['linux','darwin','tizenrt']:
51     target_files += [ os.path.join(src_dir,
52                                    'linux/caipnwmonitor.c') ]
53
54 if target_os in ['ios']:
55     target_files += [ os.path.join(src_dir, 'ios/caipnwmonitor.m') ]
56
57 if target_os in ['msys_nt']:
58         target_files += [ os.path.join(src_dir, 'windows/caipnwmonitor.c') ]
59
60 # The list of BLE adapter source files is a combination of both the
61 # common and target-specific source file lists.
62 env.AppendUnique(CA_SRC = common_files + target_files)