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