#
##
+import os
+
# Load common build config
SConscript('build_common/SConscript')
# Prepare libraries
env.PrepareLib('cereal')
env.PrepareLib('expat')
- env.PrepareLib('boost', 'boost_thread', env.get('SRC_DIR') + '/extlibs/boost/')
- env.PrepareLib('boost', 'boost_system', env.get('SRC_DIR') + '/extlibs/boost/')
+ env.PrepareLib('boost', 'boost_thread', os.path.join(env.get('SRC_DIR'), 'extlibs', 'boost'))
+ env.PrepareLib('boost', 'boost_system', os.path.join(env.get('SRC_DIR'), 'extlibs', 'boost'))
# By default, src_dir is current dir, the build_dir is:
# ./out/<target_os>/<target_arch>/<release or debug>/
build_dir = env.get('BUILD_DIR')
# Build 'resource' sub-project
-SConscript(build_dir + 'resource/SConscript')
+SConscript(os.path.join(build_dir, 'resource', 'SConscript'))
# Build 'service' sub-project
-SConscript(build_dir + 'service/SConscript')
+SConscript(os.path.join(build_dir, 'service', 'SConscript'))
# Append targets information to the help information, to see help info, execute command line:
# $ scon [options] -h
if tc_path:
env.PrependENVPath('PATH', tc_path)
- sys_root = os.path.abspath(tc_path + '/../')
+ sys_root = os.path.abspath(os.path.join(tc_path, '..'))
env.AppendUnique(CCFLAGS = ['--sysroot=' + sys_root])
env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root])
# env.get('BUILD_DIR')
def __set_dir(env, dir):
- if not os.path.exists(dir + '/SConstruct'):
+ if not os.path.exists(os.path.join(dir, 'SConstruct')):
print '''
*************************************** Error *********************************
* The directory(%s) seems isn't a source code directory, no SConstruct file is
''' % dir
Exit(1)
+ build_dir = os.path.join(dir, 'out', target_os, target_arch)
if env.get('RELEASE'):
- build_dir = dir + '/out/' + target_os + '/' + target_arch + '/release/'
+ build_dir = os.path.join(build_dir, 'release')
else:
- build_dir = dir + '/out/' + target_os + '/' + target_arch + '/debug/'
+ build_dir = os.path.join(build_dir, 'debug')
env.VariantDir(build_dir, dir, duplicate=0)
env.Replace(BUILD_DIR = build_dir)
# External library include files are in <src_dir>/deps/<target_os>/include
# the library binaries are in <src_dir>/deps/<target_os>/lib/<arch>
-env.AppendUnique(CPPPATH = [env.get('SRC_DIR') + '/deps/' + target_os + '/include'])
-env.AppendUnique(LIBPATH = [env.get('SRC_DIR') + '/deps/' + target_os + '/lib/' + target_arch])
+env.AppendUnique(CPPPATH = [os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'include')])
+env.AppendUnique(LIBPATH = [os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'lib', target_arch)])
# Check whether a library exists, if not, notify user to install it or try to
# download the source code and build it
if path:
dir = path
else:
- dir = env.get('SRC_DIR') + '/extlibs/' + libname
+ dir = os.path.join(env.get('SRC_DIR'), 'extlibs', libname)
# Execute the script to download(if required) and build source code
if script:
- st = dir + '/' + script
+ st = os.path.join(dir, script)
else:
- st = dir + '/SConscript'
+ st = os.path.join(dir, 'SConscript')
if os.path.exists(st):
SConscript(st)
# Install header file(s) to <src_dir>/deps/<target_os>/include
def __install_head_file(ienv, file):
- return ienv.Install(env.get('SRC_DIR') + '/deps/' + target_os + '/include', file)
+ return ienv.Install(os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'include'), file)
# Install library binaries to <src_dir>/deps/<target_os>/lib/<arch>
def __install_lib(ienv, lib):
- return ienv.Install(env.get('SRC_DIR') + '/deps/' + target_os + '/lib/' + target_arch, lib)
+ return ienv.Install(os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'lib', target_arch), lib)
SConscript('tools/UnpackAll.py')
pass
# Write a user-config for this variant
-user_config_name = cwd+os.sep+'tools'+os.sep+'build'+os.sep+'src'+os.sep+'user-config.jam'
+user_config_name = os.path.join(cwd, 'tools', 'build', 'src', 'user-config.jam')
user_config_file = open(user_config_name, 'w')
user_config_file.write('import os ;\n')
user_config_file.write('using gcc :')
# Ensure that the toolchain is in the PATH
penv = os.environ.copy()
-penv["PATH"] = tool_path+":" + penv["PATH"]
+penv["PATH"] = tool_path + ":" + penv["PATH"]
-build_path = 'build' + os.sep + target_os + os.sep + target_arch
+build_path = os.path.join('build', target_os, target_arch)
cmd.append('-q')
cmd.append('target-os=linux')
raise SCons.Errors.BuildError( "Building boost [%s] on the source [%s]" % (cmd, boost_b2_name) )
# Use Copy instead of InstallXXX to make sure boost is installed immediately
-Execute(Copy(env.get('SRC_DIR') + '/deps/' + target_os + '/include',
- boost_base_name + os.sep + build_path + os.sep + 'install_tmp' + os.sep + 'include'))
+Execute(Copy(os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'include'),
+ os.path.join(boost_base_name, build_path, 'install_tmp', 'include')))
+
+Execute(Copy(os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'lib', target_arch),
+ os.path.join(boost_base_name, build_path, 'install_tmp', 'lib')))
-Execute(Copy(env.get('SRC_DIR') + '/deps/' + target_os + '/lib/' + target_arch,
- boost_base_name + os.sep + build_path + os.sep + 'install_tmp' + os.sep + 'lib'))
# library management rule, cereal should be put in extlibs/cereal/cereal.
# jenkins of gerrit server, still follow the old, to avoid jenkins fail
# both places are handled.
-old = src_dir + '/extlibs/cereal/include'
-cur = src_dir + '/extlibs/cereal/cereal/include'
+old = os.path.join(src_dir, 'extlibs', 'cereal', 'include')
+cur = os.path.join(src_dir, 'extlibs', 'cereal', 'cereal', 'include')
# check 'cereal' library, if it doesn't exits, ask user to download it
if not os.path.exists(old) and not os.path.exists(cur):