Fix new compile check BB2 utility not dealing with dotted version

numbers.
This commit is contained in:
Rene Rivera
2015-08-07 08:29:55 -05:00
parent 6d448857ed
commit 2fb725a93d
2 changed files with 43 additions and 27 deletions

View File

@ -14,6 +14,7 @@ import toolset ;
import modules ;
import path ;
import "class" : new ;
import regex ;
# Create a project for our targets.
project.extension predef check ;
@ -21,31 +22,6 @@ project.extension predef check ;
# Feature to pass check expressions to check programs.
feature.feature predef-expression : : free ;
.c.ext = c ;
.cpp.ext = cpp ;
.objc.ext = m ;
.objcpp.ext = mm ;
# Check targets. Each needs to be compiled for different languages
# even though they are all the same source code.
local rule check_target ( language key : requirements * )
{
# Need to use absolute paths because we don't know the
# context of the invocation which affects where the paths
# originate from.
local predef_jam
= [ modules.binding $(__name__) ] ;
local source_path
= $(predef_jam:D)/predef_check_cc_as_$(language).$(.$(language).ext) ;
local include_path
= $(predef_jam:D)/../include ;
obj predef_check_cc_$(key)
: $(source_path)
: <include>$(include_path) $(requirements) ;
explicit predef_check_cc_$(key) ;
return predef_check_cc_$(key) ;
}
# Checks the expressions and when used evaluates to the true-properties
# if the expressions are all true. Otherwise evaluates to the
# false-properties.
@ -72,7 +48,7 @@ rule check ( expressions + : language ? : true-properties * : false-properties *
{
_checks_ += $(key) ;
_message_(/check/predef//predef_check_cc_$(key)) = $(expression) ;
check_target $(language) $(key) : <define>\"CHECK=$(expression)\" ;
check_target $(language) $(key) : [ change_term_to_def $(expression) ] ;
}
terms += /check/predef//predef_check_cc_$(key) ;
@ -93,6 +69,46 @@ rule require ( expressions + : language ? )
return [ check $(expressions) : $(language) : : <build>no ] ;
}
#############################################################################
.c.ext = c ;
.cpp.ext = cpp ;
.objc.ext = m ;
.objcpp.ext = mm ;
# Check targets. Each needs to be compiled for different languages
# even though they are all the same source code.
local rule check_target ( language key : requirements * )
{
# Need to use absolute paths because we don't know the
# context of the invocation which affects where the paths
# originate from.
local predef_jam
= [ modules.binding $(__name__) ] ;
local source_path
= $(predef_jam:D)/predef_check_cc_as_$(language).$(.$(language).ext) ;
local include_path
= $(predef_jam:D)/../include ;
obj predef_check_cc_$(key)
: $(source_path)
: <include>$(include_path) $(requirements) ;
explicit predef_check_cc_$(key) ;
return predef_check_cc_$(key) ;
}
local rule change_term_to_def ( term )
{
local parts = [ regex.split $(term) " " ] ;
if $(parts[3])
{
local version_number = [ regex.split $(parts[3]) "[.]" ] ;
if ! $(version_number[3]) { version_number += "0" ; }
if ! $(version_number[3]) { version_number += "0" ; }
parts = $(parts[1-2]) BOOST_VERSION_NUMBER($(version_number:J=",")) ;
}
return <define>CHECK=\"$(parts:J=" ")\" ;
}
class check-expression-evaluator
{
import configure ;

View File

@ -58,7 +58,7 @@ test-suite predef :
[ compile macos_endian.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ]
[ compile macos_vs_bsd.c : [ predef-require "BOOST_OS_MACOS" : cpp ] ]
[ run check_value.cpp : : : <test-info>always_show_run_output
[ predef-check "BOOST_COMP_CLANG > 0" "BOOST_OS_LINUX == 0" : : <cxxflags>-DCHECK_VALUE=true ] ]
[ predef-check "BOOST_COMP_CLANG > 0.0.0" "BOOST_OS_LINUX == 0" : : <cxxflags>-DCHECK_VALUE=true ] ]
;
# Minimal testing done for predef for CI. Since