1 import os, string, sys, subprocess
5 boost_env = env.Clone()
7 modules = ['thread','program_options', 'system', 'date_time']
9 target_os = env.get('TARGET_OS')
10 target_arch = env.get('TARGET_ARCH')
11 src_dir = env.get('SRC_DIR')
13 boost_version = '1.60.0'
15 # TODO: Remove coupling between build scripts and 1_58_0 version for Android
16 if target_os in ['android']:
17 boost_version = '1.58.0'
19 boost_base_name = 'boost_'+string.replace(boost_version,'.','_')
20 boost_arch_name = boost_base_name+'.zip'
21 boost_b2_name = boost_base_name+os.sep+'b2'
22 boost_url = 'http://downloads.sourceforge.net/project/boost/boost/'+boost_version+'/'+boost_arch_name+'?r=&ts=1421801329&use_mirror=iweb'
24 boost_dir = os.path.join(src_dir, 'extlibs','boost')
25 boost_bootstrap = os.path.join(boost_dir,'bootstrap.bat')
27 if 'linux' == target_os :
28 # Check for Boost libraries in /usr/boost
29 print 'TODO: Perform platform check for linux'
30 raise SCons.Errors.EnvironmentError('Unsupported platform')
32 elif target_os in ['windows']:
33 if not os.path.exists(boost_bootstrap) and target_os == 'windows':
34 # TODO: Enable installation of Boost via SConscript
36 *********************************** Error: ****************************************
37 * Please download boost from the following website:
39 * ''' + boost_url + '''
41 * and extract the contents directly into:
43 * ''' + boost_dir + '''
45 * such that you can find:
47 * ''' + boost_bootstrap + '''
49 ***********************************************************************************
53 elif target_os in ['android']:
54 env.Tool('URLDownload', toolpath=['../../tools/scons'])
55 env.Tool('UnpackAll', toolpath=['../../tools/scons'])
56 env.Tool('BoostBootstrap', toolpath=['../../tools/scons'])
57 env.Tool('BoostBuild', toolpath=['../../tools/scons'])
59 host_os = sys.platform
61 if host_os == 'linux2' :
62 boost_bootstrap = boost_base_name+os.sep+'bootstrap.sh'
64 msg="Host platform (%s) is currently not supported for boost builds" % host_os
65 raise SCons.Errors.EnvironmentError(msg)
67 if not os.path.exists(boost_arch_name) and not os.path.exists(boost_base_name):
68 boost_arch_name = env.URLDownload(boost_arch_name, boost_url)
70 if not os.path.exists(boost_base_name):
71 boost_arch_name = env.UnpackAll(boost_bootstrap, boost_arch_name)
73 boost_b2 = env.BoostBootstrap(boost_b2_name, boost_arch_name)
75 dep_sys_root = env['DEP_SYS_ROOT']
76 dep_src_dir = dep_sys_root + os.sep + 'include'
77 dep_lib_dir = dep_sys_root + os.sep + 'lib'
80 os.path.join(dep_src_dir, 'boost', 'config.hpp'),
81 os.path.join(dep_src_dir, 'boost', 'variant.hpp'),
82 os.path.join(dep_src_dir, 'boost', 'program_options.hpp'),
83 os.path.join(dep_src_dir, 'boost', 'thread.hpp'),
84 os.path.join(dep_src_dir, 'boost', 'date_time.hpp'),
85 os.path.join(dep_src_dir, 'libboost_thread.a'),
86 os.path.join(dep_src_dir, 'libboost_date_time.a'),
87 os.path.join(dep_src_dir, 'libboost_atomic.a'),
88 os.path.join(dep_src_dir, 'libboost_system.a'),
89 os.path.join(dep_src_dir, 'libboost_program_options.a')
92 boost_build = env.BoostBuild(boost_targets, boost_b2, PREFIX=dep_sys_root, MODULES=modules)