1 ######################################################################
2 # This script manages third party libraries
4 #Note: The paths must keep consistent with oic-resource
5 ######################################################################
9 Import('env', 'lib_env')
11 target_os = env.get('TARGET_OS')
12 target_arch = env.get('TARGET_ARCH')
13 src_dir = env.get('SRC_DIR')
15 if target_os not in ['linux', 'darwin']:
16 utils_path = env.get('OIC_UTILS')
18 resource_path = src_dir + '/resource'
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():
27 *********************************** Warning ***********************************
28 * You are trying cross build, please make sure (%s) version libraries are
30 *******************************************************************************
33 conf = Configure(lib_env)
35 if not conf.CheckLib('boost_thread'):
36 print 'Did not find boost_thread, exiting!'
39 if not conf.CheckLib('boost_system'):
40 print 'Did not find boost_system, exiting!'
45 ######################################################################
46 # The 'include' path of external libraries
47 ######################################################################
48 lib_env.AppendUnique(CPPPATH = [
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'
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',
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'
75 if target_arch not in ['x86', 'armeabi', 'armeabi-v7a']:
76 if not env.GetOption('help') and not env.GetOption('clean'):
78 *********************************** Warning ***********************************
79 * current only x86, armeabi, armeabi-v7a libraries are provided! *
80 *******************************************************************************
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,
88 # Too much boost warning, suppress the warning
89 lib_env.AppendUnique(CCFLAGS = ['-w'])
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'])
99 lib_env.AppendUnique(LIBPATH = env.get('BUILD_DIR'))