516174be73d34b56ad498978761ce9307fa0982f
[platform/upstream/iotivity.git] / extlibs / boost / SConscript
1 import os, string, sys
2
3 Import('env')
4
5 modules = ['thread','program_options']
6
7 target_os = env.get('TARGET_OS')
8
9 if 'linux' == target_os :
10     # Check for Boost libraries in /usr/boost
11     print 'TODO: Perform platform check for linux'
12     raise SCons.Errors.EnvironmentError('Unsupported platform')
13
14 if 'android' == target_os :
15     env.Tool('URLDownload',    toolpath=['../../tools/scons'])
16     env.Tool('UnpackAll',      toolpath=['../../tools/scons'])
17     env.Tool('BoostBootstrap', toolpath=['../../tools/scons'])
18     env.Tool('BoostBuild',     toolpath=['../../tools/scons'])
19
20     boost_version   = '1.57.0'
21     boost_base_name  = 'boost_'+string.replace(boost_version,'.','_')
22     boost_arch_name  = boost_base_name+'.zip'
23     boost_url       = 'http://downloads.sourceforge.net/project/boost/boost/'+boost_version+'/'+boost_arch_name+'?r=&ts=1421801329&use_mirror=iweb'
24
25     host_os = sys.platform
26
27     if host_os == 'linux2' :
28         boost_bootstrap = boost_base_name+os.sep+'bootstrap.sh'
29         boost_b2_name    = boost_base_name+os.sep+'b2'
30     else :
31         msg="Host platform (%s) is currently not supported for boost builds" % host_os
32         raise SCons.Errors.EnvironmentError(msg)
33
34     boost_zip = env.URLDownload(boost_arch_name, boost_url)
35     boost_dir = env.UnpackAll(boost_bootstrap, boost_zip)
36     boost_b2  = env.BoostBootstrap(boost_b2_name, boost_dir)
37
38     dep_sys_root = env['DEP_SYS_ROOT']
39     dep_src_dir =  dep_sys_root + os.sep + 'include'
40     dep_lib_dir =  dep_sys_root + os.sep + 'lib'
41
42     boost_targets = [
43         os.path.join(dep_src_dir, 'boost', 'config.hpp'),
44         os.path.join(dep_src_dir, 'boost', 'variant.hpp'),
45         os.path.join(dep_src_dir, 'boost', 'program_options.hpp'),
46         os.path.join(dep_src_dir, 'libboost_thread.a'),
47         os.path.join(dep_src_dir, 'libboost_atomic.a'),
48         os.path.join(dep_src_dir, 'libboost_system.a'),
49         os.path.join(dep_src_dir, 'libboost_program_options.a')
50         ]
51
52     boost_build = env.BoostBuild(boost_targets, boost_b2, PREFIX=dep_sys_root, MODULES=modules)
53