[SSM] Apply changed OIC API
[platform/upstream/iotivity.git] / service / third_party_libs.scons
1 ######################################################################
2 # This script manages third party libraries
3 #
4 #Note: The paths must keep consistent with oic-resource
5 ######################################################################
6 import os
7 import platform
8
9 Import('env', 'lib_env')
10
11 target_os = env.get('TARGET_OS')
12 target_arch = env.get('TARGET_ARCH')
13 src_dir = env.get('SRC_DIR')
14
15 if target_os not in ['linux', 'darwin']:
16         utils_path = env.get('OIC_UTILS')
17
18 resource_path = src_dir + '/resource'
19
20 ######################################################################
21 # Check dependent packages (Linux only)
22 ######################################################################
23 if target_os == 'linux':
24         if not env.GetOption('help'):
25                 if not target_arch == platform.machine():
26                         print '''
27 *********************************** Warning ***********************************
28 * You are trying cross build, please make sure (%s) version libraries are
29 * installed!                                                                  *
30 *******************************************************************************
31 ''' % target_arch
32
33                 conf = Configure(lib_env)
34
35                 if not conf.CheckLib('boost_thread'):
36                         print 'Did not find boost_thread, exiting!'
37                         Exit(1)
38
39                 if not conf.CheckLib('boost_system'):
40                         print 'Did not find boost_system, exiting!'
41                         Exit(1)
42
43                 conf.Finish()
44
45 ######################################################################
46 # The 'include' path of external libraries
47 ######################################################################
48 lib_env.AppendUnique(CPPPATH = [
49                 resource_path ,
50                 resource_path + '/include' ,
51                 resource_path + '/oc_logger/include',
52                 resource_path + '/csdk/stack/include',
53                 resource_path + '/csdk/ocsocket/include',
54                 resource_path + '/csdk/ocrandom/include',
55                 resource_path + '/csdk/logger/include'
56                 ])
57
58 ######################################################################
59 # The 'include' path of third party libraries
60 ######################################################################
61 if target_os == 'android':
62         lib_env.AppendUnique(CPPPATH = [
63                                         utils_path + '/android/boost/include',
64                                         utils_path + '/android/expat/include/expat/',
65                                         utils_path + '/android/openssl/include',
66                                 ])
67
68 ######################################################################
69 # The path of third party libraries binary
70 ######################################################################
71 if target_os == 'android':
72         if target_arch == 'armeabi-v7a-hard':
73                 target_arch = 'armeabi-v7a'
74
75         if target_arch not in ['x86', 'armeabi', 'armeabi-v7a']:
76                 if not env.GetOption('help') and not env.GetOption('clean'):
77                         print '''
78 *********************************** Warning ***********************************
79 * current only x86, armeabi, armeabi-v7a libraries are provided!              *
80 *******************************************************************************
81 '''
82         else:
83                 lib_env.AppendUnique(LIBPATH = [
84                                                                 utils_path + '/android/boost/libs/' + target_arch,
85                                                                 utils_path + '/android/expat/lib/' + target_arch,
86                                                                 utils_path + '/android/openssl/lib/' + target_arch,
87                                                         ])
88                 # Too much boost warning, suppress the warning
89                 lib_env.AppendUnique(CCFLAGS = ['-w'])
90
91 elif target_os == 'ios':
92         lib_env.AppendUnique(FRAMEWORKPATH = [utils_path + '/ios/frameworks/'])
93         lib_env.AppendUnique(FRAMEWORKS = ['boost', 'expat', 'openssl'])
94 elif target_os == 'darwin':
95         lib_env.AppendUnique(CPPPATH = ['/usr/local/include'])
96         lib_env.AppendUnique(LIBPATH = ['/usr/local/lib'])
97
98 Import('env')
99 lib_env.AppendUnique(LIBPATH = env.get('BUILD_DIR'))