[IOT-2324]warning fix 1
[platform/upstream/iotivity.git] / build_common / external_libs.scons
1 ##
2 # This script manages external libraries
3 #
4 # By default, assume the script for an exteranl library is:
5 #    <src_dir>/extlibs/<libname>/SConscript
6 #
7 # Note: After the external library is built:
8 #   Head files should be installed to <src_dir>/deps/<target_os>/include
9 #   lib(e.g .so, .a) should be installed to <src_dir>/deps/<target_os>/lib/<arch>
10 #
11 ##
12 import os
13
14 Import('env')
15
16 target_os = env.get('TARGET_OS')
17 target_arch = env.get('TARGET_ARCH')
18 rd_mode = env.get('RD_MODE')
19
20 # for android, doesn't distinguish 'armeabi-v7a-hard' and 'armeabi-v7a' library
21 if target_os == 'android':
22     if target_arch == 'armeabi-v7a-hard':
23         target_arch = 'armeabi-v7a'
24     env.AppendUnique(CCFLAGS = ['-D__JAVA__'])
25
26 if target_os == 'darwin':
27     env.AppendUnique(CPPPATH = ['/usr/local/include'])
28     env.AppendUnique(LIBPATH = ['/usr/local/lib'])
29
30 if env.get('BUILD_JAVA') == True and target_os != 'android':
31     if env.get('JAVA_HOME') != None:
32             env.AppendUnique(CCFLAGS = ['-D__JAVA__'])
33             env.AppendUnique(CPPPATH = [
34             env.get('JAVA_HOME') + '/include',
35             env.get('JAVA_HOME') + '/include/' + target_os
36         ])
37     else:
38         raise SCons.Errors.StopError( 'BUILD_JAVA is specified, but JAVA_HOME is not set.')
39
40 # External library include files are in <src_dir>/deps/<target_os>/include
41 # the library binaries are in <src_dir>/deps/<target_os>/lib/<arch>
42 if target_os not in ['windows']:
43     env.AppendUnique(CPPPATH = [os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'include')])
44     env.AppendUnique(LIBPATH = [os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'lib', target_arch)])
45
46 # tinycbor build/fetch
47 SConscript(os.path.join(env.get('SRC_DIR'), 'extlibs', 'tinycbor', 'SConscript'))
48
49 #cJSON lib
50 SConscript(os.path.join(env.get('SRC_DIR'), 'extlibs', 'cjson', 'SConscript'))
51
52 with_ra = env.get('WITH_RA')
53 if with_ra:
54     SConscript(os.path.join(env.get('SRC_DIR'), 'extlibs', 'raxmpp', 'SConscript'))
55
56 with_ra_ibb = env.get('WITH_RA_IBB')
57 if with_ra_ibb:
58     SConscript(os.path.join(env.get('SRC_DIR'), 'extlibs', 'wksxmppxep', 'SConscript'))
59
60 if env.get('SECURED') == '1' or 'SERVER' in rd_mode:
61     if target_os not in ['linux', 'tizen']:
62         SConscript('#extlibs/sqlite3/SConscript')