################################
#       Build BLE adapter
################################
import os

Import('connectivity_env')

src_dir = os.path.abspath(os.curdir)

target_os = connectivity_env.get('TARGET_OS')

print "Reading BLE adapter script for", target_os

# Source files common to all platforms.
connectivity_env.AppendUnique(CA_SRC = [ os.path.join(src_dir, 'caleadapter.c') ])

# Check for the existence of the platform-specific SConscript file
# relative to the top-level source directory, not the build (variant)
# directory, before calling that SConscript file to prevent a missing
# file warning platforms that don't provide one.
target_sconscript = File(os.path.join(target_os, 'SConscript')).srcnode().abspath
if os.path.exists(target_sconscript):
    SConscript(target_sconscript, exports='connectivity_env')
