Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / nfc_adapter / SConscript
1 #######################################################
2 #    Build NFC 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 src_dir = './nfc_adapter/'
13
14
15 # Source files to build common for all platforms
16 common_files = [ os.path.join(src_dir,
17                                   'canfcadapter.c') ]
18
19 # Get list of target-specific source file base names, i.e. no parent
20 # directories prepended to the path.
21 #
22 # Target-specific SConscript files are expected to return that list.
23 target_files = []
24 target_sconscript = os.path.join(target_os, 'SConscript')
25
26 # Check for the existence of the platform-specific SConscript file
27 # relative to the top-level source directory, not the build (variant)
28 # directory, before calling that SConscript file to prevent a missing
29 # file warning platforms that don't provide one.
30 target_sconscript_abspath = str(File(target_sconscript).srcnode().abspath)
31 if os.path.exists(target_sconscript_abspath):
32         target_files = env.SConscript(target_sconscript, exports='src_dir')
33
34 # Now prepend the appropriate parent directories
35 # (e.g. ./nfc_adapter/android) to each of the target source files in
36 # the list.
37 target_files = [ os.path.join(src_dir, target_os, f) for f in target_files ]
38
39 #common and target-specific source file lists.
40 env.AppendUnique(CA_SRC = common_files + target_files)