|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59867 - in trunk: . libs/math/build libs/math/src tools/build/v2 tools/build/v2/build
From: ghost_at_[hidden]
Date: 2010-02-24 07:26:27
Author: vladimir_prus
Date: 2010-02-24 07:26:26 EST (Wed, 24 Feb 2010)
New Revision: 59867
URL: http://svn.boost.org/trac/boost/changeset/59867
Log:
Configuration framework and boost.math long long configuration.
Added:
trunk/libs/math/src/long_double_check.cpp (contents, props changed)
trunk/tools/build/v2/build/configure.jam (contents, props changed)
Text files modified:
trunk/Jamroot | 29 ++++++++++++++++++----
trunk/libs/math/build/Jamfile.v2 | 51 ++++++++++++++++++++++++++++++++++++---
trunk/tools/build/v2/build-system.jam | 24 ++++++++++++++++++
3 files changed, 94 insertions(+), 10 deletions(-)
Modified: trunk/Jamroot
==============================================================================
--- trunk/Jamroot (original)
+++ trunk/Jamroot 2010-02-24 07:26:26 EST (Wed, 24 Feb 2010)
@@ -135,6 +135,8 @@
import project ;
import option ;
import xsltproc ;
+import build-system ;
+import configure ;
path-constant BOOST_ROOT : . ;
constant BOOST_VERSION : 1.43.0 ;
@@ -208,6 +210,7 @@
# purposes, there's no library to build and install.
all-libraries = [ set.difference $(all-libraries) : function_types ] ;
+configure.register-components $(all-libraries) ;
local rule explicit-alias ( id : targets + )
{
@@ -330,6 +333,7 @@
# Select the libraries to install.
libraries = [ libraries-to-install $(all-libraries) ] ;
+configure.components-building $(libraries) ;
if --show-libraries in [ modules.peek : ARGV ]
{
@@ -667,8 +671,23 @@
"\nBuilding the Boost C++ Libraries.\n\n" ;
explicit explain ;
-import build-system ;
-rule say ( ok ? )
+rule pre-build ( )
+{
+ local tl = [ modules.peek : top-level-targets ] ;
+ if stage in $(tl) || install in $(tl)
+ {
+ # FIXME: remove if when Boost regression tests use trunk
+ # bjam.
+ if PAD in [ RULENAMES ]
+ {
+ configure.print-component-configuration ;
+ }
+ }
+}
+IMPORT $(__name__) : pre-build : : $(__name__).pre-build ;
+build-system.set-pre-build-hook $(__name__).pre-build ;
+
+rule post-build ( ok ? )
{
if forward in [ modules.peek : top-level-targets ]
{
@@ -688,10 +707,8 @@
}
}
}
-IMPORT $(__name__) : say : : $(__name__).say ;
-
-build-system.set-post-build-hook $(__name__).say ;
-
+IMPORT $(__name__) : post-build : : $(__name__).post-build ;
+build-system.set-post-build-hook $(__name__).post-build ;
# This rule should be called from libraries' Jamfiles and will create two
# targets, "install" and "stage", that will install or stage that library. The
Modified: trunk/libs/math/build/Jamfile.v2
==============================================================================
--- trunk/libs/math/build/Jamfile.v2 (original)
+++ trunk/libs/math/build/Jamfile.v2 2010-02-24 07:26:26 EST (Wed, 24 Feb 2010)
@@ -63,11 +63,54 @@
sph_neumann
;
-if --disable-long-double in [ modules.peek : ARGV ]
-{
- long-double-opts = <build>no ;
-}
+# Configure checks.
+
+import project ;
+import configure ;
+import property ;
+import property-set ;
+
+exe long_double_check : ../src/long_double_check.cpp ;
+explicit long_double_check ;
+
+local .long-double-reported ;
+project = [ project.current ] ;
+
+rule long-double-configure ( properties * )
+{
+ local disabled ;
+ if [ option.get disable-long-double : : yes ]
+ {
+ disabled = true ;
+ }
+ else
+ {
+ # The presence of long double depends only on toolset.
+ local toolset = [ property.select <toolset> : $(properties) ] ;
+ local ps = [ property-set.create $(toolset) ] ;
+ local ap = [ $(ps).as-path ] ;
+
+ if ! [ configure.builds long_double_check : $(project) : $(ps)
+ : "long double support" ]
+ {
+ if ! $(.long-double-reported)
+ {
+ configure.log-component-configuration math :
+ "long long not available, skipping boost_math_tr1l/boost_math_c99l" ;
+ .long-double-reported = true ;
+ }
+ disabled = true ;
+ }
+ }
+ if $(disabled)
+ {
+ return <build>no ;
+ }
+}
+
+long-double-opts = <conditional>@long-double-configure ;
+# Library targets
lib boost_math_tr1 : ../src/tr1/$(TR1_SOURCES).cpp pch
:
<link>shared:<define>BOOST_MATH_TR1_DYN_LINK=1
Added: trunk/libs/math/src/long_double_check.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/math/src/long_double_check.cpp 2010-02-24 07:26:26 EST (Wed, 24 Feb 2010)
@@ -0,0 +1,6 @@
+
+int main()
+{
+ long double x;
+ return 0;
+}
Modified: trunk/tools/build/v2/build-system.jam
==============================================================================
--- trunk/tools/build/v2/build-system.jam (original)
+++ trunk/tools/build/v2/build-system.jam 2010-02-24 07:26:26 EST (Wed, 24 Feb 2010)
@@ -26,6 +26,7 @@
import version ;
import virtual-target ;
import generators ;
+import configure ;
################################################################################
#
@@ -113,6 +114,11 @@
.default-toolset-version = $(version) ;
}
+rule set-pre-build-hook ( function )
+{
+ .pre-build-hook = $(function) ;
+}
+
rule set-post-build-hook ( function )
{
.post-build-hook = $(function) ;
@@ -702,6 +708,17 @@
generators.dump ;
}
+ # We wish to put config.log in the build directory corresponding
+ # to Jamroot, so that the location does not differ depending on
+ # directory where we do build. The amount of indirection necessary
+ # here is scary.
+ local first-project = [ $(targets[0]).project ] ;
+ local first-project-root-location = [ $(first-project).get project-root ] ;
+ local first-project-root-module = [ project.load $(first-project-root-location) ] ;
+ local first-project-root = [ project.target $(first-project-root-module) ] ;
+ local first-build-build-dir = [ $(first-project-root).build-dir ] ;
+ configure.set-log-file $(first-build-build-dir)/config.log ;
+
# Now that we have a set of targets to build and a set of property sets to
# build the targets with, we can start the main build process by using each
# property set to generate virtual targets from all of our listed targets
@@ -952,6 +969,13 @@
}
else
{
+ configure.print-configure-checks-summary ;
+
+ if $(.pre-build-hook)
+ {
+ $(.pre-build-hook) ;
+ }
+
DEPENDS all : $(actual-targets) ;
if UPDATE_NOW in [ RULENAMES ]
{
Added: trunk/tools/build/v2/build/configure.jam
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/build/configure.jam 2010-02-24 07:26:26 EST (Wed, 24 Feb 2010)
@@ -0,0 +1,157 @@
+# Copyright (c) 2010 Vladimir Prus.
+#
+# Use, modification and distribution is subject to the Boost Software
+# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
+# http://www.boost.org/LICENSE_1_0.txt)
+
+# This module defines function to help with two main tasks:
+#
+# - Discovering build-time configuration for the purposes of adjusting
+# build process.
+# - Reporting what is built, and how it is configured.
+
+import targets ;
+import errors ;
+import targets ;
+import sequence ;
+
+rule log-summary ( )
+{
+
+}
+
+.width = 30 ;
+
+rule set-width ( width )
+{
+ .width = $(width) ;
+}
+
+# Declare that the components specified by the parameter exist.
+rule register-components ( components * )
+{
+ .components += $(components) ;
+}
+
+# Declare that the components specified by the parameters will
+# be build.
+rule components-building ( components * )
+{
+ .built-components += $(components) ;
+}
+
+# Report something about component configuration that the
+# user should better know.
+rule log-component-configuration ( component : message )
+{
+ # FIXME: implement per-property-set logs
+ .component-logs.$(component) += $(message) ;
+}
+
+rule log-check-result ( result )
+{
+ .check-results += $(result) ;
+}
+
+rule print-component-configuration ( )
+{
+ local c = [ sequence.unique $(.components) ] ;
+
+ ECHO "Component configuration:\n" ;
+ for c in $(.components)
+ {
+ local s ;
+ if $(c) in $(.built-components)
+ {
+ s = "building" ;
+ }
+ else
+ {
+ s = "not building" ;
+ }
+ ECHO [ PAD " - $(c)" : $(.width) ] ": $(s)" ;
+ for local m in $(.component-logs.$(c))
+ {
+ ECHO " -" $(m) ;
+ }
+ }
+ ECHO ;
+}
+
+rule print-configure-checks-summary ( )
+{
+ # FIXME: the problem with that approach is tha
+ # the user sees checks summary when all checks are
+ # done, and has no progress reporting while the
+ # checks are being executed.
+ if $(.check-results)
+ {
+ ECHO "Configuration checks summary\n" ;
+
+ for local r in $(.check-results)
+ {
+ ECHO $(r) ;
+ }
+ ECHO ;
+ }
+}
+
+# Attempt to build a metatarget named by 'metatarget-reference'
+# in context of 'project' with properties 'ps'.
+# Returns non-empty value if build is OK.
+rule builds ( metatarget-reference : project : ps : what )
+{
+ local result ;
+
+ if ! $(.$(what)-tested.$(ps))
+ {
+ .$(what)-tested.$(ps) = true ;
+
+ local targets = [ targets.generate-from-reference
+ $(metatarget-reference) : $(project) : $(ps) ] ;
+
+ local jam-targets ;
+ for local t in $(targets[2-])
+ {
+ jam-targets += [ $(t).actualize ] ;
+ }
+
+ if ! UPDATE_NOW in [ RULENAMES ]
+ {
+ # Cannot determine. Assume existance.
+ }
+ else
+ {
+ local x = [ PAD " - $(what)" : $(.width) ] ;
+ if [ UPDATE_NOW $(jam-targets) : $(.log-fd) : ignore-minus-n ]
+ {
+ .$(what)-supported.$(ps) = yes ;
+ result = true ;
+ log-check-result "$(x) : yes" ;
+ }
+ else
+ {
+ log-check-result "$(x) : no" ;
+ }
+ }
+ return $(result) ;
+ }
+ else
+ {
+ return $(.$(what)-supported.$(ps)) ;
+ }
+}
+
+# Called by Boost.Build startup code to specify name of a file
+# that will receive results of configure checks. This
+# should never be called by users.
+rule set-log-file ( log-file )
+{
+ # FIXME: remove this check as soon as Boost regression tests
+ # start using trunk bjam
+ if FILE_OPEN in [ RULENAMES ]
+ {
+ .log-fd = [ FILE_OPEN $(log-file) : "w" ] ;
+ }
+}
+
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