summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct5
1 files changed, 5 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index 28414f0..28bd4a9 100644
--- a/SConstruct
+++ b/SConstruct
@@ -11,12 +11,13 @@ vars.Add('ccflags', "Extra C(++) compiler flags")
vars.Add('linkflags', "Extra linker flags")
vars.Add(EnumVariable("test", "Compile and run tests", "none", ["none", "all", "unit", "system"]))
vars.Add(BoolVariable("optimize", "Compile with optimizations turned on", "no"))
vars.Add(BoolVariable("debug", "Compile with debug information", "yes" if os.name != "nt" else "no"))
vars.Add(BoolVariable("warnings", "Compile with warnings turned on",
"yes" if os.name != "nt" else "no"))
+vars.Add(BoolVariable("max_jobs", "Build with maximum number of parallel jobs", "no"))
if os.name != "nt" :
vars.Add(BoolVariable("coverage", "Compile with coverage information", "no"))
if os.name == "posix" :
vars.Add(BoolVariable("valgrind", "Run tests with valgrind", "no"))
if os.name == "mac" :
vars.Add(BoolVariable("universal", "Create universal binaries", "no"))
@@ -50,12 +51,16 @@ if env["PLATFORM"] == "win32" :
# Override SConscript to handle tests
oldSConscript = SConscript
def SConscript(*arguments, **keywords) :
if not keywords.get("test_only", False) or env["TEST"] :
return apply(oldSConscript, arguments, keywords)
+# Max out the number of jobs
+if env["max_jobs"] :
+ import multiprocessing
+ SetOption("num_jobs", multiprocessing.cpu_count())
# Default compiler flags
env["CCFLAGS"] = env.get("ccflags", [])
env["LINKFLAGS"] = env.get("linkflags", [])
if env["optimize"] :
env.Append(CCFLAGS = "-O2")