diff options
Diffstat (limited to 'src/third_party')
-rw-r--r-- | src/third_party/SConscript | 263 | ||||
-rw-r--r-- | src/third_party/s2/SConscript | 3 | ||||
-rw-r--r-- | src/third_party/v8-3.25/SConscript | 4 | ||||
-rw-r--r-- | src/third_party/v8/SConscript | 4 |
4 files changed, 192 insertions, 82 deletions
diff --git a/src/third_party/SConscript b/src/third_party/SConscript index dd899f75571..8ca97359bcc 100644 --- a/src/third_party/SConscript +++ b/src/third_party/SConscript @@ -2,101 +2,212 @@ Import("env use_system_version_of_library windows darwin usev8 v8suffix solaris boostSuffix") -env.SConscript( [ - "murmurhash3/SConscript", - "s2/SConscript", - ] ) -env.Append(CPPPATH='$BUILD_DIR/third_party/s2') +thirdPartyIncludePathMap = { + 'boost' : '#/src/third_party/boost' + boostSuffix, + 'gperftools' : '#/src/third_party/gperftools-2.2', + 'pcre' : '#/src/third_party/pcre-${PCRE_VERSION}', + 's2' : '#/src/third_party/s2', + 'snappy' : '#/src/third_party/snappy', + 'stemmer' : '#/src/third_party/libstemmer_c/include', + 'tz' : '#/src/third_party/tz', + 'v8' : '#/src/third_party/v8' + v8suffix + '/include', + 'yaml' : '#/src/third_party/yaml-cpp-0.5.1/include', +} + +def injectAllThirdPartyIncludePaths(thisEnv): + thisEnv.AppendUnique(CPPPATH=thirdPartyIncludePathMap.values()) + +def injectThirdPartyIncludePaths(thisEnv, libraries): + thisEnv.AppendUnique(CPPPATH=[thirdPartyIncludePathMap[lib] for lib in libraries]) + +env.AddMethod(injectAllThirdPartyIncludePaths, 'InjectAllThirdPartyIncludePaths') +env.AddMethod(injectThirdPartyIncludePaths, 'InjectThirdPartyIncludePaths') + + +murmurEnv = env.Clone() +murmurEnv.SConscript('murmurhash3/SConscript', exports={ 'env' : murmurEnv }) + + +s2Env = env.Clone() +s2Env.InjectThirdPartyIncludePaths(libraries=['s2', 'boost']) +s2Env.InjectMongoIncludePaths() +s2Env.SConscript('s2/SConscript', exports={'env' : s2Env}) + if use_system_version_of_library("pcre"): - env.Library( "shim_pcrecpp", ['shim_pcrecpp.cc'], - SYSLIBDEPS=[ - env['LIBDEPS_PCRE_SYSLIBDEP'], - env['LIBDEPS_PCRECPP_SYSLIBDEP'] - ] ) + pcreEnv = env.Clone( + SYSLIBDEPS=[ + env['LIBDEPS_PCRE_SYSLIBDEP'], + env['LIBDEPS_PCRECPP_SYSLIBDEP'], + ]) else: - env.SConscript('pcre-${PCRE_VERSION}/SConscript') - env.Library( "shim_pcrecpp", ['shim_pcrecpp.cc'], - LIBDEPS=[ 'pcre-${PCRE_VERSION}/pcrecpp' ] ) + pcreEnv = env.Clone() + pcreEnv.InjectThirdPartyIncludePaths(libraries=['pcre']) + pcreEnv.SConscript('pcre-${PCRE_VERSION}/SConscript', exports={ 'env' : pcreEnv }) + pcreEnv = pcreEnv.Clone( + LIBDEPS=[ + 'pcre-${PCRE_VERSION}/pcrecpp', + ]) + +pcreEnv.Library( + target="shim_pcrecpp", + source=[ + 'shim_pcrecpp.cc', + ]) + +boostEnv = env if use_system_version_of_library("boost"): - 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'] - ] ) + # On windows, we don't need the syslibdeps because autolib will select the right libraries + # for us automatically. + if not windows: + boostEnv = env.Clone( + SYSLIBDEPS=[ + env['LIBDEPS_BOOST_PROGRAM_OPTIONS_SYSLIBDEP'], + env['LIBDEPS_BOOST_FILESYSTEM_SYSLIBDEP'], + env['LIBDEPS_BOOST_THREAD_SYSLIBDEP'], + env['LIBDEPS_BOOST_SYSTEM_SYSLIBDEP'], + ]) else: boostDirectory = 'boost' + boostSuffix - env.SConscript(boostDirectory + '/SConscript') - env.Library( "shim_boost", ['shim_boost.cpp'], - LIBDEPS=[ boostDirectory + '/boost_program_options', - boostDirectory + '/boost_filesystem', - boostDirectory + '/boost_thread', - boostDirectory + '/boost_system', - ] ) + boostEnv = env.Clone() + boostEnv.InjectThirdPartyIncludePaths(libraries=['boost']) + boostEnv.SConscript(boostDirectory + '/SConscript', exports={ 'env' : boostEnv }) + boostEnv = boostEnv.Clone( + LIBDEPS=[ + boostDirectory + '/boost_program_options', + boostDirectory + '/boost_filesystem', + boostDirectory + '/boost_thread', + boostDirectory + '/boost_system', + ]) + +boostEnv.Library( + target="shim_boost", + source=[ + 'shim_boost.cpp', + ]) + if use_system_version_of_library("snappy"): - env.Library("shim_snappy", ['shim_snappy.cpp'], - SYSLIBDEPS=[ - env['LIBDEPS_SNAPPY_SYSLIBDEP'] - ] ) + snappyEnv = env.Clone( + SYSLIBDEPS=[ + env['LIBDEPS_SNAPPY_SYSLIBDEP'], + ]) else: - env.Append(CPPPATH='$BUILD_DIR/third_party/snappy') - env.SConscript('snappy/SConscript') - env.Library('shim_snappy', ['shim_snappy.cpp'], LIBDEPS=['snappy/snappy']) + snappyEnv = env.Clone() + snappyEnv.InjectThirdPartyIncludePaths(libraries=['snappy']) + snappyEnv.SConscript('snappy/SConscript', exports={ 'env' : snappyEnv }) + snappyEnv = snappyEnv.Clone( + LIBDEPS=[ + 'snappy/snappy', + ]) + +snappyEnv.Library( + target="shim_snappy", + source=[ + 'shim_snappy.cpp', + ]) + if usev8: if use_system_version_of_library("v8"): - env.Library("shim_v8", ['shim_v8.cpp'], SYSLIBDEPS=[ - env['LIBDEPS_V8_SYSLIBDEP'] ]) + v8Env = env.Clone( + SYSLIBDEPS=[ + env['LIBDEPS_v8_SYSLIBDEP'], + ]) else: - env.Append(CPPPATH='$BUILD_DIR/third_party/v8' + v8suffix + '/include') - env.SConscript('v8' + v8suffix + '/SConscript') - env.Library('shim_v8', ['shim_v8.cpp'], LIBDEPS=['v8' + v8suffix + '/v8']) - -if (GetOption("allocator") != "tcmalloc"): - env.Library("shim_allocator", "shim_allocator.cpp") -elif use_system_version_of_library("tcmalloc"): - env.Library("shim_allocator", "shim_allocator.cpp", - SYSLIBDEPS=[ - env['LIBDEPS_TCMALLOC_SYSLIBDEP'] - ] ) -else: - env.SConscript('gperftools-2.2/SConscript') - env.Library('shim_allocator', 'shim_allocator.cpp', - LIBDEPS=['gperftools-2.2/tcmalloc_minimal']) + v8Env = env.Clone() + v8Env.InjectThirdPartyIncludePaths(libraries=['v8']) + v8Env.SConscript('v8' + v8suffix + '/SConscript', exports={'env' : v8Env }) + v8Env = v8Env.Clone( + LIBDEPS=[ + 'v8' + v8suffix + '/v8' + ]) + + v8Env.Library( + target="shim_v8", + source=[ + 'shim_v8.cpp', + ]) + + +gperftoolsEnv = env +if (GetOption("allocator") == "tcmalloc"): + if use_system_version_of_library("tcmalloc"): + gperftoolsEnv = env.Clone( + SYSLIBDEPS=[ + env['LIBDEPS_TCMALLOC_SYSLIBDEP'], + ]) + else: + gperftoolsEnv = env.Clone() + gperftoolsEnv.InjectThirdPartyIncludePaths(libraries=['gperftools']) + gperftoolsEnv.InjectMongoIncludePaths() + gperftoolsEnv.SConscript('gperftools-2.2/SConscript', exports={ 'env' : gperftoolsEnv }) + gperftoolsEnv = gperftoolsEnv.Clone( + LIBDEPS=[ + 'gperftools-2.2/tcmalloc_minimal', + ]) + +gperftoolsEnv.Library( + target="shim_allocator", + source=[ + "shim_allocator.cpp", + ]) + if use_system_version_of_library("stemmer"): - env.Library("shim_stemmer", ['shim_stemmer.cpp'], - SYSLIBDEPS=[ - env['LIBDEPS_STEMMER_SYSLIBDEP'] - ] ) + stemmerEnv = env.Clone( + SYSLIBDEPS=[ + env['LIBDEPS_STEMMER_SYSLIBDEP'], + ]) else: - env.SConscript('libstemmer_c/SConscript') - env.Library("shim_stemmer", ['shim_stemmer.cpp'], - LIBDEPS=['libstemmer_c/stemmer']) + stemmerEnv = env.Clone() + stemmerEnv.InjectThirdPartyIncludePaths(libraries=['stemmer']) + stemmerEnv.SConscript('libstemmer_c/SConscript', exports={ 'env' : stemmerEnv }) + stemmerEnv = stemmerEnv.Clone( + LIBDEPS=[ + 'libstemmer_c/stemmer', + ]) + +stemmerEnv.Library( + target="shim_stemmer", + source=[ + 'shim_stemmer.cpp' + ]) + if use_system_version_of_library("yaml"): - env.Library("shim_yaml", ['shim_yaml.cpp'], - SYSLIBDEPS=[ - env['LIBDEPS_YAML_SYSLIBDEP'] - ] ) + yamlEnv = env.Clone( + SYSLIBDEPS=[ + env['LIBDEPS_YAML_SYSLIBDEP'], + ]) else: - env.Append(CPPPATH='$BUILD_DIR/third_party/yaml-cpp-0.5.1/include') - env.SConscript('yaml-cpp-0.5.1/SConscript') - env.Library("shim_yaml", ['shim_yaml.cpp'], - LIBDEPS=['yaml-cpp-0.5.1/yaml']) + yamlEnv = env.Clone() + yamlEnv.InjectThirdPartyIncludePaths(libraries=['yaml', 'boost']) + yamlEnv.SConscript('yaml-cpp-0.5.1/SConscript', exports={ 'env' : yamlEnv }) + yamlEnv = yamlEnv.Clone( + LIBDEPS=[ + 'yaml-cpp-0.5.1/yaml', + ]) + +yamlEnv.Library( + target="shim_yaml", + source=[ + 'shim_yaml.cpp', + ]) + +tzEnv = env.Clone() if solaris: - env.Append(CPPPATH='$BUILD_DIR/third_party/tz') - env.SConscript('tz/SConscript') - env.Library('shim_tz', ['shim_tz.cpp'], LIBDEPS=['tz/tz']) -else: - env.Library('shim_tz', ['shim_tz.cpp'], LIBDEPS=[]) + tzEnv.InjectThirdPartyIncludePaths(libraries=['tz']) + tzEnv.SConscript('tz/SConscript', exports={ 'env' : tzEnv }) + tzEnv = tzEnv.Clone( + LIBDEPS=[ + 'tz/tz', + ]) + +tzEnv.Library( + target='shim_tz', + source=[ + 'shim_tz.cpp', + ]) diff --git a/src/third_party/s2/SConscript b/src/third_party/s2/SConscript index 4397cdf0f89..3c57cdb1d58 100644 --- a/src/third_party/s2/SConscript +++ b/src/third_party/s2/SConscript @@ -9,9 +9,8 @@ env.SConscript( [ "strings/SConscript", "util/coding/SConscript", "util/math/SConscript", - ] ) + ], exports={ 'env' : env }) -env.Append(CCFLAGS=['-Isrc/third_party/s2']) env.Append(CCFLAGS=['-DDEBUG_MODE=false']) # Clang warns about struct/class tag mismatch, but as long as this is diff --git a/src/third_party/v8-3.25/SConscript b/src/third_party/v8-3.25/SConscript index 73482e4e613..8b07efa709f 100644 --- a/src/third_party/v8-3.25/SConscript +++ b/src/third_party/v8-3.25/SConscript @@ -424,8 +424,8 @@ env = env.Clone() # in addition, v8 source needs to compile with src/parser.h, which # is being placed here earlier in the search path than windows sdk's # Include/parser.h (v8 doesn't even use any of those header files) -env['CPPPATH'].remove('$BUILD_DIR/third_party/v8-3.25/include') -env.Prepend(CPPPATH='$BUILD_DIR/third_party/v8-3.25/src') +env['CPPPATH'].remove('#/src/third_party/v8-3.25/include') +env.Prepend(CPPPATH='#/src/third_party/v8-3.25/src') # add v8 ccflags and cppdefines to environment if they're not already # present diff --git a/src/third_party/v8/SConscript b/src/third_party/v8/SConscript index 3566bd63ffd..956bab19b38 100644 --- a/src/third_party/v8/SConscript +++ b/src/third_party/v8/SConscript @@ -354,8 +354,8 @@ env = env.Clone() # in addition, v8 source needs to compile with src/parser.h, which # is being placed here earlier in the search path than windows sdk's # Include/parser.h (v8 doesn't even use any of those header files) -env['CPPPATH'].remove('$BUILD_DIR/third_party/v8/include') -env.Prepend(CPPPATH='$BUILD_DIR/third_party/v8/src') +env['CPPPATH'].remove('#/src/third_party/v8/include') +env.Prepend(CPPPATH='#/src/third_party/v8/src') # add v8 ccflags and cppdefines to environment if they're not already # present |