2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-20 02:32:13 +00:00

Configuration framework and boost.math long long configuration.

[SVN r59867]
This commit is contained in:
Vladimir Prus
2010-02-24 12:26:26 +00:00
parent b50d69df13
commit 1fb10d066c
2 changed files with 181 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ import utility ;
import version ;
import virtual-target ;
import generators ;
import configure ;
################################################################################
#
@@ -113,6 +114,11 @@ rule set-default-toolset ( toolset : version ? )
.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 @@ local rule should-clean-project ( project )
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 @@ local rule should-clean-project ( project )
}
else
{
configure.print-configure-checks-summary ;
if $(.pre-build-hook)
{
$(.pre-build-hook) ;
}
DEPENDS all : $(actual-targets) ;
if UPDATE_NOW in [ RULENAMES ]
{

157
v2/build/configure.jam Normal file
View File

@@ -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" ] ;
}
}