Imported Upstream version 1.0.1
[platform/upstream/iotivity.git] / resource / csdk / connectivity / samples / android / SConscript
1 ##
2 # Building sample application
3 ##
4
5 Import('env')
6
7 app_env = env.Clone()
8
9 ca_os = app_env.get('TARGET_OS')
10 ca_transport = app_env.get('TARGET_TRANSPORT')
11 secured = app_env.get('SECURED')
12
13 root_dir = './../../'
14 main_dir  = Dir('.').srcnode().abspath
15 jni_dir = main_dir + '/sample_serivce/android/jni'
16 env.PrependUnique(CPPPATH = ['jni_dir'])
17 app_env.PrependUnique(CPPDEFINES = ['__ANDROID__'])
18
19 #####################################################################
20 # Source files and Target(s)
21 ######################################################################
22
23 print"Reading ca script %s"%ca_transport
24
25 app_env.AppendUnique(CPPPATH = [root_dir + '/api/'])
26 app_env.AppendUnique(CPPPATH = [root_dir + '/inc/'])
27 app_env.AppendUnique(CPPPATH = [root_dir + '/common/inc/'])
28 app_env.AppendUnique(CPPPATH = [root_dir + 'lib/libcoap-4.1.1'])
29
30 print "Reading sample application build script"
31
32 build_dir = app_env.get('BUILD_DIR')
33 secured = app_env.get('SECURED')
34
35 print "Sample secured flag is %s" % secured
36
37 sample_dir = 'casample/sampleService/src/main/jni/'
38 sample_src = [sample_dir + 'ResourceModel.c',]
39
40 print " sample src %s" % sample_src
41
42 app_env.AppendUnique(LIBPATH = [app_env.get('BUILD_DIR'), '.',])
43 app_env.AppendUnique(CPPPATH = ['lib/android'])
44 app_env.PrependUnique(LIBS = ['connectivity_abstraction'])
45 app_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
46
47
48 if secured == '1':
49         app_env.AppendUnique(CPPPATH = [root_dir + 'external/inc/'])
50         app_env.PrependUnique(CPPDEFINES = ['__WITH_DTLS__'])
51
52 libRMInterface = app_env.SharedLibrary('RMInterface', sample_src, OBJPREFIX='libRMInterface_')
53 app_env.InstallTarget(libRMInterface, 'RMInterface')
54 app_env.UserInstallTargetLib(libRMInterface, 'RMInterface')
55
56