Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / bt_le_adapter / SConscript
1 ################################
2 #       Build BLE adapter
3 ################################
4
5 Import('env')
6 import os.path
7
8 target_os = env.get('TARGET_OS')
9
10 print "Reading BLE adapter script for", target_os
11
12 src_dir = os.path.join(os.curdir, 'bt_le_adapter')
13
14 # Source files to build common for all platforms.
15 common_files = None
16 common_files = [ os.path.join(src_dir,
17                                       'caleadapter.c') ]
18
19
20 # Get list of target-specific source file base names, i.e. no parent
21 # directories prepended to the path.
22 #
23 # Target-specific SConscript files are expected to return that list.
24 target_files = []
25 target_sconscript = os.path.join(target_os, 'SConscript')
26
27 # Check for the existence of the platform-specific SConscript file
28 # relative to the top-level source directory, not the build (variant)
29 # directory, before calling that SConscript file to prevent a missing
30 # file warning platforms that don't provide one.
31 target_sconscript_abspath = str(File(target_sconscript).srcnode().abspath)
32 if os.path.exists(target_sconscript_abspath):
33         target_files = env.SConscript(target_sconscript, exports='src_dir')
34
35 # Now prepend the appropriate parent directories
36 # (e.g. ./bt_le_adapter/linux) to each of the target source files in
37 # the list.
38 target_files = [ os.path.join(src_dir, target_os, f) for f in target_files ]
39
40 # The list of BLE adapter source files is a combination of both the
41 # common and target-specific source file lists.
42 env.AppendUnique(CA_SRC = common_files + target_files)
43