Merge Resource Directory into the master
[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', 'system', 'date_time']
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_b2_name    = boost_base_name+os.sep+'b2'
27     boost_url       = 'http://downloads.sourceforge.net/project/boost/boost/'+boost_version+'/'+boost_arch_name+'?r=&ts=1421801329&use_mirror=iweb'
28
29     host_os = sys.platform
30
31     if host_os == 'linux2' :
32         boost_bootstrap = boost_base_name+os.sep+'bootstrap.sh'
33     else :
34         msg="Host platform (%s) is currently not supported for boost builds" % host_os
35         raise SCons.Errors.EnvironmentError(msg)
36
37     if not os.path.exists(boost_arch_name) and not os.path.exists(boost_base_name):
38         boost_arch_name = env.URLDownload(boost_arch_name, boost_url)
39
40     if not os.path.exists(boost_base_name):
41         boost_arch_name = env.UnpackAll(boost_bootstrap, boost_arch_name)
42
43     boost_b2  = env.BoostBootstrap(boost_b2_name, boost_arch_name)
44
45     dep_sys_root = env['DEP_SYS_ROOT']
46     dep_src_dir =  dep_sys_root + os.sep + 'include'
47     dep_lib_dir =  dep_sys_root + os.sep + 'lib'
48
49     boost_targets = [
50         os.path.join(dep_src_dir, 'boost', 'config.hpp'),
51         os.path.join(dep_src_dir, 'boost', 'variant.hpp'),
52         os.path.join(dep_src_dir, 'boost', 'program_options.hpp'),
53         os.path.join(dep_src_dir, 'boost', 'thread.hpp'),
54         os.path.join(dep_src_dir, 'boost', 'date_time.hpp'),
55         os.path.join(dep_src_dir, 'libboost_thread.a'),        
56         os.path.join(dep_src_dir, 'libboost_date_time.a'),
57         os.path.join(dep_src_dir, 'libboost_atomic.a'),
58         os.path.join(dep_src_dir, 'libboost_system.a'),
59         os.path.join(dep_src_dir, 'libboost_program_options.a')
60         ]
61
62     boost_build = env.BoostBuild(boost_targets, boost_b2, PREFIX=dep_sys_root, MODULES=modules)
63