|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51000 - in sandbox/SCons: . libs tools/scons
From: loonycyborg_at_[hidden]
Date: 2009-02-03 17:09:08
Author: loonycyborg
Date: 2009-02-03 17:09:08 EST (Tue, 03 Feb 2009)
New Revision: 51000
URL: http://svn.boost.org/trac/boost/changeset/51000
Log:
Added support for debug/release and static/dynamic build variants.
Added:
sandbox/SCons/tools/scons/boost-build-variants.py (contents, props changed)
Text files modified:
sandbox/SCons/SConstruct | 2 +-
sandbox/SCons/libs/SConscript | 24 ++++++++++++++++++------
sandbox/SCons/tools/scons/boost-libs.py | 5 ++++-
3 files changed, 23 insertions(+), 8 deletions(-)
Modified: sandbox/SCons/SConstruct
==============================================================================
--- sandbox/SCons/SConstruct (original)
+++ sandbox/SCons/SConstruct 2009-02-03 17:09:08 EST (Tue, 03 Feb 2009)
@@ -1,7 +1,7 @@
# vi: syntax=python:et:ts=4
EnsureSConsVersion(0, 98, 5)
-env = Environment(toolpath = ["tools/scons"], tools = ["default", "boost-libs"])
+env = Environment(toolpath = ["tools/scons"], tools = ["default", "boost-libs", "boost-build-variants"])
Export("env")
SConscript("libs/SConscript")
Modified: sandbox/SCons/libs/SConscript
==============================================================================
--- sandbox/SCons/libs/SConscript (original)
+++ sandbox/SCons/libs/SConscript 2009-02-03 17:09:08 EST (Tue, 03 Feb 2009)
@@ -2,12 +2,24 @@
Import("env")
env.Append(
CPPPATH = "#/",
- CXXFLAGS = "-ftemplate-depth-128"
+ CPPDEFINES = ["BOOST_ALL_NO_LIB=1"],
+ CCFLAGS = Split("$DEBUG_RELEASE_CCFLAGS $THREADING_CCFLAGS"),
+ LIBFLAGS = Split("$DEBUG_RELEASE_LIBFLAGS $THREADING_LIBFLAGS")
)
sconscripts = Glob("*/build/SConscript")
-for sconscript in sconscripts:
- lib = str(sconscript.get_dir().up())
- VariantDir(src_dir = lib + "/src", variant_dir = "#/bin.SCons/" + lib, duplicate = False)
- VariantDir(src_dir = lib + "/build", variant_dir = lib + "/src", duplicate = False)
- SConscript("#/bin.SCons/" + lib + "/SConscript")
+for debug_release in ["debug", "release"]:
+ for linking in ["static", "dynamic"]:
+ env["DEBUG_RELEASE_CCFLAGS"] = env.get(debug_release.upper() + "_CCFLAGS")
+ env["DEBUG_RELEASE_LIBFLAGS"] = env.get(debug_release.upper() + "_LIBFLAGS")
+ env.AppendUnique(CPPDEFINES = ["${LINK_DYNAMIC and 'BOOST_' + BOOST_LIB + '_DYN_LINK=1' or []}"])
+ if linking == "dynamic":
+ env["LINK_DYNAMIC"] = True
+ else:
+ env["LINK_DYNAMIC"] = False
+ for sconscript in sconscripts:
+ lib = str(sconscript.get_dir().up())
+ target_dir = "#/bin.SCons/" + lib + "/" + debug_release + "/" + linking
+ VariantDir(src_dir = lib + "/src", variant_dir = target_dir, duplicate = False)
+ VariantDir(src_dir = lib + "/build", variant_dir = lib + "/src", duplicate = False)
+ SConscript(target_dir + "/SConscript", exports = { "env" : env.Clone(BOOST_LIB = lib.upper()) })
Added: sandbox/SCons/tools/scons/boost-build-variants.py
==============================================================================
--- (empty file)
+++ sandbox/SCons/tools/scons/boost-build-variants.py 2009-02-03 17:09:08 EST (Tue, 03 Feb 2009)
@@ -0,0 +1,12 @@
+# vi: syntax=python:et:ts=4
+from SCons.Script import Split
+
+def exists():
+ return True
+
+def generate(env):
+ env["CXXFLAGS"] = Split("-ftemplate-depth-128 -Wall")
+ env["THREADING_MULTI_CCFLAGS"] = "-pthread"
+ env["THREADING_MULTI_LIBFLAGS"] = "-pthread"
+ env["DEBUG_CCFLAGS"] = Split("-O0 -g -fno-inline")
+ env["RELEASE_CCFLAGS"] = Split("-O3 -DNDEBUG -finline-functions -Wno-inline")
Modified: sandbox/SCons/tools/scons/boost-libs.py
==============================================================================
--- sandbox/SCons/tools/scons/boost-libs.py (original)
+++ sandbox/SCons/tools/scons/boost-libs.py 2009-02-03 17:09:08 EST (Tue, 03 Feb 2009)
@@ -1,7 +1,10 @@
# vi: syntax=python:et:ts=4
def BoostLibrary(env, lib, sources):
- env.StaticLibrary("boost_" + lib, sources)
+ if env["LINK_DYNAMIC"]:
+ env.SharedLibrary("boost_" + lib, sources)
+ else:
+ env.StaticLibrary("boost_" + lib, sources)
def exists(env):
return True
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