a22bc36b44aa49bfaa1e50823b81c07d67c5ea9e
[platform/upstream/iotivity.git] / resource / third_party_libs.scons
1 ######################################################################
2 # This script manages third party libraries
3 #
4 #Note: The paths must keep consistent with oic-utilities
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 ######################################################################
19 # Check dependent packages (Linux only)
20 ######################################################################
21 if target_os == 'linux':
22         if not env.GetOption('help'):
23                 if not target_arch == platform.machine():
24                         print '''
25 *********************************** Warning ***********************************
26 * You are trying cross build, please make sure (%s) version libraries are
27 * installed!                                                                  *
28 *******************************************************************************
29 ''' % target_arch
30
31                 conf = Configure(lib_env)
32
33                 if not conf.CheckLib('boost_program_options'):
34                         print 'Did not find boost_program_options, exiting!'
35                         Exit(1)
36
37                 conf.Finish()
38
39 ######################################################################
40 # The 'include' path of third party libraries
41 ######################################################################
42 if target_os == 'android':
43         lib_env.AppendUnique(CPPPATH = [utils_path + '/android/boost/include'])
44
45 ######################################################################
46 # The path of third party libraries binary
47 ######################################################################
48 if target_os == 'android':
49         if target_arch == 'armeabi-v7a-hard':
50                 target_arch = 'armeabi-v7a'
51
52         if target_arch not in ['x86', 'armeabi', 'armeabi-v7a']:
53                 if not env.GetOption('help') and not env.GetOption('clean'):
54                         print '''
55 *********************************** Warning ***********************************
56 * current only x86, armeabi, armeabi-v7a libraries are provided!              *
57 *******************************************************************************
58 '''
59         else:
60                 lib_env.AppendUnique(LIBPATH = [utils_path + '/android/boost/libs/' + target_arch])
61                 # Too much boost warning, suppress the warning
62                 lib_env.AppendUnique(CCFLAGS = ['-w'])
63
64 elif target_os == 'ios':
65         lib_env.AppendUnique(FRAMEWORKPATH = [utils_path + '/ios/frameworks/'])
66         lib_env.AppendUnique(FRAMEWORKS = ['boost'])
67 elif target_os == 'darwin':
68         lib_env.AppendUnique(CPPPATH = ['/usr/local/include'])
69         lib_env.AppendUnique(LIBPATH = ['/usr/local/lib'])