mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 17:10:48 +01:00
SCons: Clarify determination of when to use a system version of a library.
Introduces a predicate in our build system "use_system_version_of_library" to answer the question of whether or not to use the system-supplied version of a specified library (i.e., boost).
This commit is contained in:
parent
46f203192c
commit
7655aa54ea
14
SConstruct
14
SConstruct
@ -111,6 +111,8 @@ def has_option( name ):
|
||||
|
||||
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():
|
||||
|
||||
@ -754,16 +756,16 @@ for shortName in getThirdPartyShortNames():
|
||||
options_topass["windows"] = windows
|
||||
options_topass["nix"] = nix
|
||||
|
||||
if has_option( "use-system-" + shortName ) or has_option( "use-system-all" ):
|
||||
if use_system_version_of_library(shortName):
|
||||
print( "using system version of: " + shortName )
|
||||
myModule.configureSystem( env , fileLists , options_topass )
|
||||
else:
|
||||
myModule.configure( env , fileLists , options_topass )
|
||||
|
||||
if not has_option("use-system-all") and not has_option("use-system-pcre"):
|
||||
if not use_system_version_of_library("pcre"):
|
||||
env.Prepend(CPPPATH=[ '$BUILD_DIR/third_party/pcre-${PCRE_VERSION}' ])
|
||||
|
||||
if not has_option('use-system-all') and not has_option('use-system-boost'):
|
||||
if not use_system_version_of_library("boost"):
|
||||
env.Prepend(CPPPATH=['$BUILD_DIR/third_party/boost'],
|
||||
CPPDEFINES=['BOOST_ALL_NO_LIB'])
|
||||
|
||||
@ -790,7 +792,7 @@ def doConfigure(myenv):
|
||||
print( "can't find stdc++ library which is needed" );
|
||||
Exit(1)
|
||||
|
||||
if has_option('use-system-all') or has_option('use-system-boost'):
|
||||
if use_system_version_of_library("boost"):
|
||||
if not conf.CheckCXXHeader( "boost/filesystem/operations.hpp" ):
|
||||
print( "can't find boost headers" )
|
||||
Exit(1)
|
||||
@ -1056,7 +1058,7 @@ if len(COMMAND_LINE_TARGETS) > 0 and 'uninstall' in COMMAND_LINE_TARGETS:
|
||||
clientEnv = env.Clone()
|
||||
clientEnv['CPPDEFINES'].remove('MONGO_EXPOSE_MACROS')
|
||||
|
||||
if not has_option('use-system-all') and not has_option('use-system-boost'):
|
||||
if not use_system_version_of_library("boost"):
|
||||
clientEnv.Append(LIBS=['boost_thread', 'boost_filesystem', 'boost_system'])
|
||||
clientEnv.Prepend(LIBPATH=['$BUILD_DIR/third_party/boost/'])
|
||||
|
||||
@ -1074,7 +1076,7 @@ Export("env")
|
||||
Export("clientEnv")
|
||||
Export("shellEnv")
|
||||
Export("testEnv")
|
||||
Export("has_option")
|
||||
Export("has_option use_system_version_of_library")
|
||||
Export("installSetup")
|
||||
Export("usesm usev8")
|
||||
Export("darwin windows solaris linux nix")
|
||||
|
6
src/third_party/SConscript
vendored
6
src/third_party/SConscript
vendored
@ -1,12 +1,12 @@
|
||||
# -*- mode: python -*-
|
||||
|
||||
Import( "env has_option" )
|
||||
Import( "env use_system_version_of_library" )
|
||||
|
||||
env.SConscript( [
|
||||
"murmurhash3/SConscript",
|
||||
] )
|
||||
|
||||
if has_option( "use-system-pcre" ) or has_option( "use-system-all" ):
|
||||
if use_system_version_of_library("pcre"):
|
||||
env.StaticLibrary( "pcrecpp", ['mongo_pcrecpp.cc'],
|
||||
SYSLIBDEPS=[ 'pcre' , 'pcrecpp' ] )
|
||||
else:
|
||||
@ -14,7 +14,7 @@ else:
|
||||
env.StaticLibrary( "pcrecpp", ['mongo_pcrecpp.cc'],
|
||||
LIBDEPS=[ 'pcre-${PCRE_VERSION}/pcrecpp' ] )
|
||||
|
||||
if has_option('use-system-all') or has_option('use-system-boost'):
|
||||
if use_system_version_of_library("boost"):
|
||||
env.StaticLibrary("mongo_boost", ['mongo_boost.cpp'])
|
||||
else:
|
||||
env.SConscript('boost/SConscript')
|
||||
|
Loading…
Reference in New Issue
Block a user