0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

SERVER-12403 permit use-system-boost on Windows to work with autolib linking

This commit is contained in:
Eric Milkie 2014-01-17 16:55:29 -05:00
parent 6f7364be38
commit a6c4e86b0a
2 changed files with 21 additions and 39 deletions

View File

@ -84,8 +84,6 @@ use_clang = False
options = {}
options_topass = {}
def add_option( name, help, nargs, contributesToVariantDir,
dest=None, default = None, type="string", choices=None, metavar=None ):
@ -114,7 +112,7 @@ def add_option( name, help, nargs, contributesToVariantDir,
def get_option( name ):
return GetOption( name )
def _has_option( name ):
def has_option( name ):
x = get_option( name )
if x is None:
return False
@ -127,19 +125,12 @@ def _has_option( name ):
return True
def has_option( name ):
x = _has_option(name)
if name not in options_topass:
# if someone already set this, don't overwrite
options_topass[name] = x
return x
def use_system_version_of_library(name):
return has_option('use-system-all') or has_option('use-system-' + name)
def get_variant_dir():
if has_option('variant-dir'):
return "#build/" + get_option('variant-dir')
substitute = lambda x: re.sub( "[:,\\\\/]" , "_" , x )
@ -192,6 +183,7 @@ add_option( "distmod", "additional piece for full dist name" , 1 , False )
add_option( "nostrip", "do not strip installed binaries" , 0 , False )
add_option( "extra-variant-dirs", "extra variant dir components, separated by commas", 1, False)
add_option( "add-branch-to-variant-dir", "add current git branch to the variant dir", 0, False )
add_option( "variant-dir", "override variant subdirectory", 1, False )
add_option( "sharedclient", "build a libmongoclient.so/.dll" , 0 , False )
add_option( "full", "include client and headers when doing scons install", 0 , False )
@ -222,9 +214,6 @@ add_option( "extrapath", "comma separated list of add'l paths (--extrapath /opt
add_option( "extrapathdyn", "comma separated list of add'l paths (--extrapath /opt/foo/,/foo) dynamic linking" , 1 , True )
add_option( "extralib", "comma separated list of libraries (--extralib js_static,readline" , 1 , True )
add_option( "boost-compiler", "compiler used for boost (gcc41)" , 1 , True , "boostCompiler" )
add_option( "boost-version", "boost version for linking(1_38)" , 1 , True , "boostVersion" )
add_option( "no-glibc-check" , "don't check for new versions of glibc" , 0 , False )
# experimental features
@ -608,21 +597,8 @@ if has_option( "durableDefaultOn" ):
if has_option( "durableDefaultOff" ):
env.Append( CPPDEFINES=[ "_DURABLEDEFAULTOFF" ] )
boostCompiler = GetOption( "boostCompiler" )
if boostCompiler is None:
boostCompiler = ""
else:
boostCompiler = "-" + boostCompiler
boostVersion = GetOption( "boostVersion" )
if boostVersion is None:
boostVersion = ""
else:
boostVersion = "-" + boostVersion
if ( not ( usev8 or justClientLib) ):
usev8 = True
options_topass["usev8"] = True
extraLibPlaces = []
@ -1383,11 +1359,12 @@ def doConfigure(myenv):
Exit(1)
conf.env.Append(CPPDEFINES=[("BOOST_THREAD_VERSION", "2")])
# Note that on Windows with using-system-boost builds, the following
# FindSysLibDep calls do nothing useful (but nothing problematic either)
for b in boostLibs:
l = "boost_" + b
conf.FindSysLibDep(l,
[ l + boostCompiler + "-mt" + boostVersion,
l + boostCompiler + boostVersion ], language='C++' )
boostlib = "boost_" + b
conf.FindSysLibDep( boostlib, [ boostlib + "-mt", boostlib ], language='C++' )
if conf.CheckHeader('unistd.h'):
conf.env.Append(CPPDEFINES=['MONGO_HAVE_HEADER_UNISTD_H'])

View File

@ -20,13 +20,18 @@ else:
LIBDEPS=[ 'pcre-${PCRE_VERSION}/pcrecpp' ] )
if use_system_version_of_library("boost"):
env.Library("shim_boost", ['shim_boost.cpp'],
SYSLIBDEPS=[
env['LIBDEPS_BOOST_PROGRAM_OPTIONS_SYSLIBDEP'],
env['LIBDEPS_BOOST_FILESYSTEM_SYSLIBDEP'],
env['LIBDEPS_BOOST_THREAD_SYSLIBDEP'],
env['LIBDEPS_BOOST_SYSTEM_SYSLIBDEP']
] )
if windows:
# On Windows, we use the autolib feature of boost to link in the
# libraries we need, so we can't use SCons to detect them at configure time.
env.Library("shim_boost", ['shim_boost.cpp'])
else:
env.Library("shim_boost", ['shim_boost.cpp'],
SYSLIBDEPS=[
env['LIBDEPS_BOOST_PROGRAM_OPTIONS_SYSLIBDEP'],
env['LIBDEPS_BOOST_FILESYSTEM_SYSLIBDEP'],
env['LIBDEPS_BOOST_THREAD_SYSLIBDEP'],
env['LIBDEPS_BOOST_SYSTEM_SYSLIBDEP']
] )
else:
env.SConscript('boost/SConscript')
env.Library( "shim_boost", ['shim_boost.cpp'],