summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorDaniel Moody <dmoody256@gmail.com>2023-04-15 04:08:59 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-15 04:51:29 +0000
commit88a17d29b2890c0ab25ed44ddc349f3589fb6934 (patch)
tree8d9dcd4443308d034489f6041a5b3aea7df41c9d /SConstruct
parentbdb5c04f575f9c554204c4b5adf70e0ffd00a022 (diff)
downloadmongo-88a17d29b2890c0ab25ed44ddc349f3589fb6934.tar.gz
SERVER-76006 make compile half stream for smaller systems
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct35
1 files changed, 35 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index 5244cc566db..339492823a5 100644
--- a/SConstruct
+++ b/SConstruct
@@ -6427,6 +6427,41 @@ if env.get('UNITTESTS_COMPILE_CONCURRENCY'):
source_file_regex=r"^.*_test\.cpp$",
)
+first_half_flag = False
+
+
+def half_source_emitter(target, source, env):
+ global first_half_flag
+ if first_half_flag:
+ first_half_flag = False
+ if not str(source[0]).endswith('_test.cpp'):
+ env.Alias('compile_first_half_non_test_source', target)
+ else:
+ first_half_flag = True
+ return target, source
+
+
+# Cribbed from Tool/cc.py and Tool/c++.py. It would be better if
+# we could obtain this from SCons.
+_CSuffixes = [".c"]
+if not SCons.Util.case_sensitive_suffixes(".c", ".C"):
+ _CSuffixes.append(".C")
+
+_CXXSuffixes = [".cpp", ".cc", ".cxx", ".c++", ".C++"]
+if SCons.Util.case_sensitive_suffixes(".c", ".C"):
+ _CXXSuffixes.append(".C")
+
+for object_builder in SCons.Tool.createObjBuilders(env):
+ emitterdict = object_builder.builder.emitter
+ for suffix in emitterdict.keys():
+ if not suffix in _CSuffixes + _CXXSuffixes:
+ continue
+ base = emitterdict[suffix]
+ emitterdict[suffix] = SCons.Builder.ListEmitter([
+ base,
+ half_source_emitter,
+ ])
+
# Keep this late in the game so that we can investigate attributes set by all the tools that have run.
if has_option("cache"):
if get_option("cache") == "nolinked":