Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51038 - in sandbox/SCons: . libs tools/scons
From: loonycyborg_at_[hidden]
Date: 2009-02-05 16:06:36


Author: loonycyborg
Date: 2009-02-05 16:06:35 EST (Thu, 05 Feb 2009)
New Revision: 51038
URL: http://svn.boost.org/trac/boost/changeset/51038

Log:
- Implemented "profile" build configuration.

Text files modified:
   sandbox/SCons/SConstruct | 2 +-
   sandbox/SCons/libs/SConscript | 7 +++++++
   sandbox/SCons/tools/scons/boost-build-variants.py | 30 ++++++++++++++++++++++++++++--
   3 files changed, 36 insertions(+), 3 deletions(-)

Modified: sandbox/SCons/SConstruct
==============================================================================
--- sandbox/SCons/SConstruct (original)
+++ sandbox/SCons/SConstruct 2009-02-05 16:06:35 EST (Thu, 05 Feb 2009)
@@ -3,7 +3,7 @@
 
 vars = Variables("build-config.py")
 vars.AddVariables(
- ListVariable("variant", "Build configuration", "release", ["release", "debug"]),
+ ListVariable("variant", "Build configuration", "release", ["release", "debug", "profile"]),
     ListVariable("link", "Library linking", "all", ["static", "dynamic"]),
     ListVariable("threading", "Multi-threading support", "multi", ["single", "multi"])
 )

Modified: sandbox/SCons/libs/SConscript
==============================================================================
--- sandbox/SCons/libs/SConscript (original)
+++ sandbox/SCons/libs/SConscript 2009-02-05 16:06:35 EST (Thu, 05 Feb 2009)
@@ -12,6 +12,13 @@
 for variant in env["variant"]:
     env["VARIANT_CCFLAGS"] = env.get(variant.upper() + "_CCFLAGS")
     env["VARIANT_LINKFLAGS"] = env.get(variant.upper() + "_LINKFLAGS")
+ env.SetProperty(profile = False)
+ if variant == "release":
+ env.SetProperty(optimize = "speed")
+ elif variant == "debug":
+ env.SetProperty(optimize = "no")
+ elif variant == "profile":
+ env.SetProperty(optimize = "speed", profile = True)
     for linking in env["link"]:
         if linking == "dynamic":
             env["LINK_DYNAMIC"] = True

Modified: sandbox/SCons/tools/scons/boost-build-variants.py
==============================================================================
--- sandbox/SCons/tools/scons/boost-build-variants.py (original)
+++ sandbox/SCons/tools/scons/boost-build-variants.py 2009-02-05 16:06:35 EST (Thu, 05 Feb 2009)
@@ -1,12 +1,38 @@
 # vi: syntax=python:et:ts=4
 from SCons.Script import Split
 
+class gcc_features:
+ def optimize(self, env, optimize):
+ env.AppendUnique(CCFLAGS = "$OPTIMIZE_CCFLAGS")
+ if not optimize or optimize == "no":
+ env.Replace(OPTIMIZE_CCFLAGS = "-O0")
+ elif optimize == "speed":
+ env.Replace(OPTIMIZE_CCFLAGS = "-O3 -finline-functions -Wno-inline")
+ elif optimize == "space":
+ env.Replace(OPTIMIZE_CCFLAGS = "-Os")
+ else:
+ env.Replace(OPTIMIZE_CCFLAGS = "")
+
+ def profile(self, env, profile):
+ env.AppendUnique(CCFLAGS = "$PROFILE_CCFLAGS", LINKFLAGS = "$PROFILE_LINKFLAGS")
+ if profile:
+ env.Replace(PROFILE_CCFLAGS = "-pg", PROFILE_LINKFLAGS = "-pg")
+ else:
+ env.Replace(PROFILE_CCFLAGS = "", PROFILE_LINKFLAGS = "")
+
+features = gcc_features()
+
+def SetProperty(env, **kw):
+ for (prop,value) in kw.items():
+ getattr(features, prop, lambda x, y : None)(env, value)
+
 def exists():
     return True
 
 def generate(env):
     env["CXXFLAGS"] = Split("-ftemplate-depth-128 -Wall")
+ env.AddMethod(SetProperty)
     env["THREADING_MULTI_CCFLAGS"] = "-pthread"
     env["THREADING_MULTI_LINKFLAGS"] = "-pthread"
- env["DEBUG_CCFLAGS"] = Split("-O0 -g -fno-inline")
- env["RELEASE_CCFLAGS"] = Split("-O3 -DNDEBUG -finline-functions -Wno-inline")
+ env["DEBUG_CCFLAGS"] = Split("-g -fno-inline")
+ env["RELEASE_CCFLAGS"] = Split("-DNDEBUG")


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk