forked from mongodb/mongo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConscript
73 lines (62 loc) · 2.46 KB
/
SConscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# -*- mode: python; -*-
#
# This is the principle SConscript file, invoked by the SConstruct. Its job is
# to delegate to any and all per-module SConscript files.
Import("env")
Import("module_sconscripts")
Import("use_libunwind")
env = env.Clone()
# Add any "global" dependencies here. This is where we make every build node
# depend on a list of other build nodes, such as an allocator or libunwind
# or libstdx or similar.
env.AppendUnique(
LIBDEPS_GLOBAL=[
"$BUILD_DIR/third_party/gperftools/tcmalloc_minimal"
if env["MONGO_ALLOCATOR"] in ["tcmalloc-gperftools"]
else [],
"$BUILD_DIR/third_party/tcmalloc/tcmalloc"
if env["MONGO_ALLOCATOR"] in ["tcmalloc-google"]
else [],
"$BUILD_DIR/third_party/unwind/unwind" if use_libunwind else [],
],
)
# NOTE: We must do third_party first as it adds methods to the environment
# that we need in the mongo sconscript
env.SConscript("third_party/SConscript", must_exist=1, exports=["env"])
# Ensure our subsequent modifications are not shared with the
# third_party env. Normally that SConscript would have done a clone,
# so handled that isolation itself, but it doesn't since it needs to
# alter the env in ways that we need to use up here.
env = env.Clone()
# Inject common dependencies from third_party globally for all core mongo code
# and modules.
env.InjectThirdParty(
libraries=[
"abseil-cpp",
"boost",
"croaring",
"fmt",
"immer",
"tomcrypt_md5",
"murmurhash3",
"safeint",
"stemmer",
"variant",
]
)
# It would be somewhat better if this could be applied down in
# `src/mongo/SConscript`, since the goal of doing it here rather than
# up in SConstruct is to only enforce this rule for code that we wrote
# and exclude third party sources. However, doing it in
# `src/mongo/SConscript`` would also exclude applying it for modules,
# and we do want this enabled for enterprise.
if env.ToolchainIs("gcc"):
# With GCC, use the implicit fallthrough flag variant that doesn't
# care about your feeble attempts to use comments to explain yourself.
env.AddToCCFLAGSIfSupported("-Wimplicit-fallthrough=5")
elif env.ToolchainIs("clang"):
env.AddToCCFLAGSIfSupported("-Wimplicit-fallthrough")
# Run the core mongodb SConscript.
env.SConscript("mongo/SConscript", must_exist=1, exports=["env"])
# Run SConscripts for any modules in play
env.SConscript(module_sconscripts, must_exist=1, exports=["env"])