From 009367d6a1b6a26199f5b849ea166c44cf5223ff Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Thu, 7 Jan 2016 12:50:26 -0600 Subject: [PATCH] Conform to latest library requirements. --- check/predef.jam | 201 +---------------- doc/build.jam | 23 +- doc/html/index.html | 2 +- doc/html/predef/check_utilities.html | 8 +- .../reference/boost_hw_hardware_macros.html | 16 +- doc/predef.qbk | 8 +- test/build.jam | 10 +- {check => tools/check}/build.jam | 0 tools/check/predef.jam | 202 ++++++++++++++++++ {check => tools/check}/predef_check.h | 0 {check => tools/check}/predef_check_as_c.c | 0 .../check}/predef_check_as_cpp.cpp | 0 {check => tools/check}/predef_check_as_objc.m | 0 .../check}/predef_check_as_objcpp.mm | 0 {check => tools/check}/predef_check_cc.h | 0 {check => tools/check}/predef_check_cc_as_c.c | 0 .../check}/predef_check_cc_as_cpp.cpp | 0 .../check}/predef_check_cc_as_objc.m | 0 .../check}/predef_check_cc_as_objcpp.mm | 0 19 files changed, 252 insertions(+), 218 deletions(-) rename {check => tools/check}/build.jam (100%) create mode 100644 tools/check/predef.jam rename {check => tools/check}/predef_check.h (100%) rename {check => tools/check}/predef_check_as_c.c (100%) rename {check => tools/check}/predef_check_as_cpp.cpp (100%) rename {check => tools/check}/predef_check_as_objc.m (100%) rename {check => tools/check}/predef_check_as_objcpp.mm (100%) rename {check => tools/check}/predef_check_cc.h (100%) rename {check => tools/check}/predef_check_cc_as_c.c (100%) rename {check => tools/check}/predef_check_cc_as_cpp.cpp (100%) rename {check => tools/check}/predef_check_cc_as_objc.m (100%) rename {check => tools/check}/predef_check_cc_as_objcpp.mm (100%) diff --git a/check/predef.jam b/check/predef.jam index 6fec1f0..7042dc1 100644 --- a/check/predef.jam +++ b/check/predef.jam @@ -1,202 +1,17 @@ -# Copyright Rene Rivera 2015 +# Copyright Rene Rivera 2016 # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -# Defines rules that provide requirements based on checking -# conditions using Boost Predef definitions and version numbers. - +# Hack, to reload check/predef.jam at its new location. import modules ; -import project ; -import feature ; -import string ; -import toolset ; -import modules ; -import path ; -import "class" : new ; -import regex ; - -# Create a project for our targets. -project.extension predef check ; - -# Feature to pass check expressions to check programs. -feature.feature predef-expression : : free ; - -# Checks the expressions and when used evaluates to the true-properties -# if the expressions are all true. Otherwise evaluates to the -# false-properties. -rule check ( expressions + : language ? : true-properties * : false-properties * ) +local _loaded_ ; +for local _module_ in [ modules.peek modules : .loaded ] { - # Default to C++ on the check context. - language ?= cpp ; - - local project_target = [ project.target $(__name__) ] ; - project.push-current $(project_target) ; - local terms ; - local result ; - for expression in $(expressions) + if $(_module_) != "predef" { - if $(expression:L) in "and" "or" - { - terms += $(expression:L) ; - } - else - { - # Create the check run if we don't have one yet. - local key = [ MD5 $(language)::$(expression) ] ; - if ! ( $(key) in $(_checks_) ) - { - _checks_ += $(key) ; - _message_(/check/predef//predef_check_cc_$(key)) = $(expression) ; - check_target $(language) $(key) : [ change_term_to_def $(expression) ] ; - } - - terms += /check/predef//predef_check_cc_$(key) ; - } - } - local instance = [ new check-expression-evaluator - $(terms) : $(true-properties) : $(false-properties) ] ; - result = @$(instance).check ; - project.pop-current ; - return $(result) ; -} - -# Checks the expressions and when used evaluates to no -# if the expressions are all false. Otherwise evaluates to the -# nothing. -rule require ( expressions + : language ? ) -{ - return [ check $(expressions) : $(language) : : 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_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 CHECK=\"$(parts:J=" ")\" ; -} - -class check-expression-evaluator -{ - import configure ; - - rule __init__ ( expression + : true-properties * : false-properties * ) - { - self.expression = $(expression) ; - self.true-properties = $(true-properties) ; - self.false-properties = $(false-properties) ; - } - - rule check ( properties * ) - { - local to-eval ; - local tokens = "and" "or" ; - # Go through the expression and: eval the target values, - # and normalize to a full expression. - for local term in $(self.expression) - { - if ! ( $(term:L) in $(tokens) ) - { - # A value is a target reference that will evan to "true" - # or "false". - if $(to-eval[-1]:L) && ! ( $(to-eval[-1]:L) in $(tokens) ) - { - # Default to "and" operation. - to-eval += "and" ; - } - local message = [ modules.peek predef : _message_($(term)) ] ; - if [ configure.builds $(term) : $(properties) : $(message) ] - { - to-eval += "true" ; - } - else - { - to-eval += "false" ; - } - } - else - { - to-eval += $(term) ; - } - } - # Eval full the expression. - local eval-result = [ eval $(to-eval) ] ; - # And resolve true/false properties. - if $(eval-result) = "true" - { - return $(self.true-properties) ; - } - else - { - return $(self.false-properties) ; - } - } - - rule eval ( e * ) - { - local r ; - if $(e[1]) && $(e[2]) && $(e[3]) - { - if $(e[2]) = "and" - { - if $(e[1]) = "true" && $(e[3]) = "true" - { - r = [ eval "true" $(e[4-]) ] ; - } - else - { - r = [ eval "false" $(e[4-]) ] ; - } - } - else if $(e[2]) = "or" - { - if $(e[1]) = "true" || $(e[3]) = "true" - { - r = [ eval "true" $(e[4-]) ] ; - } - else - { - r = [ eval "false" $(e[4-]) ] ; - } - } - } - else - { - r = $(e[1]) ; - } - return $(r) ; + _loaded_ += $(_module_) ; } } +modules.poke modules : .loaded : $(_loaded_) ; +import ../tools/check/predef ; diff --git a/doc/build.jam b/doc/build.jam index 3965a08..79fe6ba 100644 --- a/doc/build.jam +++ b/doc/build.jam @@ -1,4 +1,4 @@ -# Copyright Rene Rivera 2011 +# Copyright Rene Rivera 2011-2016 # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) @@ -23,6 +23,9 @@ else local BOOST_PREDEF_HEADERS = [ path.glob-tree $(BOOST_PREDEF_INCLUDE_ROOT)/boost/predef : *.h ] ; +# Intermediate targets.. + +# Quickbok to boostbook target. xml predef : predef.qbk @@ -32,6 +35,15 @@ xml predef ; explicit predef ; +# HTML dependencies for standalone docs. +install images : [ glob $(BOOST_ROOT)/doc/src/images/*.png ] : html/images ; +explicit images ; +install callouts : [ glob $(BOOST_ROOT)/doc/src/images/callouts/*.png ] : html/images/callouts ; +explicit callouts ; +install css : [ glob $(BOOST_ROOT)/doc/src/*.css ] : html ; +explicit css ; + +# Default target builds standalone docs. boostbook standalone : predef @@ -46,9 +58,6 @@ boostbook standalone css ; -install images : [ glob $(BOOST_ROOT)/doc/src/images/*.png ] : html/images ; -explicit images ; -install callouts : [ glob $(BOOST_ROOT)/doc/src/images/callouts/*.png ] : html/images/callouts ; -explicit callouts ; -install css : [ glob $(BOOST_ROOT)/doc/src/*.css ] : html ; -explicit css ; +# Target for Boost global documentation integration. +alias boostdoc : predef : : : predef ; +explicit boostdoc ; diff --git a/doc/html/index.html b/doc/html/index.html index 70c1348..01fa247 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -57,7 +57,7 @@ - +

Last revised: October 15, 2015 at 04:09:31 GMT

Last revised: January 07, 2016 at 18:48:05 GMT


diff --git a/doc/html/predef/check_utilities.html b/doc/html/predef/check_utilities.html index eddfdac..847eb18 100644 --- a/doc/html/predef/check_utilities.html +++ b/doc/html/predef/check_utilities.html @@ -73,7 +73,7 @@ gets built as part of your project based on the detailed version information available in Predef. The basic use is simple:

-
import path-to-predef-src/check/predef
+
import path-to-predef-src/tools/check/predef
     : check require
     : predef-check predef-require ;
 
@@ -85,7 +85,7 @@ exe my_windows_program : windows_source.cpp
       unless one is building for Windows. Like the direct predef_check
       you can pass mutiple expressions using relational comparisons. For example:
     

-
import path-to-predef-src/check/predef
+
import path-to-predef-src/tools/check/predef
     : check require
     : predef-check predef-require ;
 
@@ -106,7 +106,7 @@ lib my_special_lib : source.cpp
       The expression can also use explicit "and", "or" logical
       operators to for more complex checks:
     

-
import path-to-predef-src/check/predef
+
import path-to-predef-src/tools/check/predef
     : check require
     : predef-check predef-require ;
 
@@ -127,7 +127,7 @@ lib my_special_lib : source.cpp
       as requirements. For example you could use it to enable or disable features
       in your programs:
     

-
import path-to-predef-src/check/predef
+
import path-to-predef-src/tools/check/predef
     : check require
     : predef-check predef-require ;
 
diff --git a/doc/html/predef/reference/boost_hw_hardware_macros.html b/doc/html/predef/reference/boost_hw_hardware_macros.html
index a291db7..f414e9f 100644
--- a/doc/html/predef/reference/boost_hw_hardware_macros.html
+++ b/doc/html/predef/reference/boost_hw_hardware_macros.html
@@ -584,7 +584,7 @@
                 
 
                   

- BOOST_HW_SIMD_x86_AVX2_VERSION + BOOST_HW_SIMD_X86_AVX2_VERSION

@@ -692,7 +692,7 @@

- BOOST_HW_SIMD_x86_SSE4A_VERSION + BOOST_HW_SIMD_X86_SSE4A_VERSION

@@ -704,7 +704,7 @@

- BOOST_HW_SIMD_x86_FMA4_VERSION + BOOST_HW_SIMD_X86_FMA4_VERSION

@@ -716,7 +716,7 @@

- BOOST_HW_SIMD_x86_XOP_VERSION + BOOST_HW_SIMD_X86_XOP_VERSION

@@ -728,7 +728,7 @@

- BOOST_HW_SIMD_x86 + BOOST_HW_SIMD_X86

@@ -1180,10 +1180,10 @@

- BOOST_HW_SIMD_X86_XOP_VERSION + BOOST_HW_SIMD_X86_FMA4_VERSION

- XOP + FMA4 x86 extension (AMD specific).

@@ -1191,7 +1191,7 @@

- BOOST_HW_SIMD_X86_XOP_VERSION + BOOST_HW_SIMD_X86_XOP_VERSION

XOP diff --git a/doc/predef.qbk b/doc/predef.qbk index 7ca4587..295113e 100644 --- a/doc/predef.qbk +++ b/doc/predef.qbk @@ -619,7 +619,7 @@ version information available in Predef. The basic use is simple: [teletype] `` -import path-to-predef-src/check/predef +import path-to-predef-src/tools/check/predef : check require : predef-check predef-require ; @@ -635,7 +635,7 @@ For example: [teletype] `` -import path-to-predef-src/check/predef +import path-to-predef-src/tools/check/predef : check require : predef-check predef-require ; @@ -663,7 +663,7 @@ to for more complex checks: [teletype] `` -import path-to-predef-src/check/predef +import path-to-predef-src/tools/check/predef : check require : predef-check predef-require ; @@ -690,7 +690,7 @@ features in your programs: [teletype] `` -import path-to-predef-src/check/predef +import path-to-predef-src/tools/check/predef : check require : predef-check predef-require ; diff --git a/test/build.jam b/test/build.jam index cc1806e..74c658c 100755 --- a/test/build.jam +++ b/test/build.jam @@ -1,5 +1,5 @@ #!/usr/bin/env b2 -a --verbose-test -# Copyright Rene Rivera 2011-2013 +# Copyright Rene Rivera 2011-2016 # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) @@ -64,4 +64,12 @@ test-suite predef : # Minimal testing done for predef for CI. Since # we don't have many we can just do all of them. alias minimal : predef ; + +# Full testing target for regular regression tests. +alias full : predef ; + +# Extra's target. Nothing for Predef. +alias extra ; + explicit minimal ; +explicit extra ; diff --git a/check/build.jam b/tools/check/build.jam similarity index 100% rename from check/build.jam rename to tools/check/build.jam diff --git a/tools/check/predef.jam b/tools/check/predef.jam new file mode 100644 index 0000000..1863906 --- /dev/null +++ b/tools/check/predef.jam @@ -0,0 +1,202 @@ +# Copyright Rene Rivera 2015 +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +# Defines rules that provide requirements based on checking +# conditions using Boost Predef definitions and version numbers. + +import modules ; +import project ; +import feature ; +import string ; +import toolset ; +import modules ; +import path ; +import "class" : new ; +import regex ; + +# Create a project for our targets. +project.extension predef check ; + +# Feature to pass check expressions to check programs. +feature.feature predef-expression : : free ; + +# Checks the expressions and when used evaluates to the true-properties +# if the expressions are all true. Otherwise evaluates to the +# false-properties. +rule check ( expressions + : language ? : true-properties * : false-properties * ) +{ + # Default to C++ on the check context. + language ?= cpp ; + + local project_target = [ project.target $(__name__) ] ; + project.push-current $(project_target) ; + local terms ; + local result ; + for expression in $(expressions) + { + if $(expression:L) in "and" "or" + { + terms += $(expression:L) ; + } + else + { + # Create the check run if we don't have one yet. + local key = [ MD5 $(language)::$(expression) ] ; + if ! ( $(key) in $(_checks_) ) + { + _checks_ += $(key) ; + _message_(/check/predef//predef_check_cc_$(key)) = $(expression) ; + check_target $(language) $(key) : [ change_term_to_def $(expression) ] ; + } + + terms += /check/predef//predef_check_cc_$(key) ; + } + } + local instance = [ new check-expression-evaluator + $(terms) : $(true-properties) : $(false-properties) ] ; + result = @$(instance).check ; + project.pop-current ; + return $(result) ; +} + +# Checks the expressions and when used evaluates to no +# if the expressions are all false. Otherwise evaluates to the +# nothing. +rule require ( expressions + : language ? ) +{ + return [ check $(expressions) : $(language) : : 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_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 CHECK=\"$(parts:J=" ")\" ; +} + +class check-expression-evaluator +{ + import configure ; + + rule __init__ ( expression + : true-properties * : false-properties * ) + { + self.expression = $(expression) ; + self.true-properties = $(true-properties) ; + self.false-properties = $(false-properties) ; + } + + rule check ( properties * ) + { + local to-eval ; + local tokens = "and" "or" ; + # Go through the expression and: eval the target values, + # and normalize to a full expression. + for local term in $(self.expression) + { + if ! ( $(term:L) in $(tokens) ) + { + # A value is a target reference that will evan to "true" + # or "false". + if $(to-eval[-1]:L) && ! ( $(to-eval[-1]:L) in $(tokens) ) + { + # Default to "and" operation. + to-eval += "and" ; + } + local message = [ modules.peek predef : _message_($(term)) ] ; + if [ configure.builds $(term) : $(properties) : $(message) ] + { + to-eval += "true" ; + } + else + { + to-eval += "false" ; + } + } + else + { + to-eval += $(term) ; + } + } + # Eval full the expression. + local eval-result = [ eval $(to-eval) ] ; + # And resolve true/false properties. + if $(eval-result) = "true" + { + return $(self.true-properties) ; + } + else + { + return $(self.false-properties) ; + } + } + + rule eval ( e * ) + { + local r ; + if $(e[1]) && $(e[2]) && $(e[3]) + { + if $(e[2]) = "and" + { + if $(e[1]) = "true" && $(e[3]) = "true" + { + r = [ eval "true" $(e[4-]) ] ; + } + else + { + r = [ eval "false" $(e[4-]) ] ; + } + } + else if $(e[2]) = "or" + { + if $(e[1]) = "true" || $(e[3]) = "true" + { + r = [ eval "true" $(e[4-]) ] ; + } + else + { + r = [ eval "false" $(e[4-]) ] ; + } + } + } + else + { + r = $(e[1]) ; + } + return $(r) ; + } +} diff --git a/check/predef_check.h b/tools/check/predef_check.h similarity index 100% rename from check/predef_check.h rename to tools/check/predef_check.h diff --git a/check/predef_check_as_c.c b/tools/check/predef_check_as_c.c similarity index 100% rename from check/predef_check_as_c.c rename to tools/check/predef_check_as_c.c diff --git a/check/predef_check_as_cpp.cpp b/tools/check/predef_check_as_cpp.cpp similarity index 100% rename from check/predef_check_as_cpp.cpp rename to tools/check/predef_check_as_cpp.cpp diff --git a/check/predef_check_as_objc.m b/tools/check/predef_check_as_objc.m similarity index 100% rename from check/predef_check_as_objc.m rename to tools/check/predef_check_as_objc.m diff --git a/check/predef_check_as_objcpp.mm b/tools/check/predef_check_as_objcpp.mm similarity index 100% rename from check/predef_check_as_objcpp.mm rename to tools/check/predef_check_as_objcpp.mm diff --git a/check/predef_check_cc.h b/tools/check/predef_check_cc.h similarity index 100% rename from check/predef_check_cc.h rename to tools/check/predef_check_cc.h diff --git a/check/predef_check_cc_as_c.c b/tools/check/predef_check_cc_as_c.c similarity index 100% rename from check/predef_check_cc_as_c.c rename to tools/check/predef_check_cc_as_c.c diff --git a/check/predef_check_cc_as_cpp.cpp b/tools/check/predef_check_cc_as_cpp.cpp similarity index 100% rename from check/predef_check_cc_as_cpp.cpp rename to tools/check/predef_check_cc_as_cpp.cpp diff --git a/check/predef_check_cc_as_objc.m b/tools/check/predef_check_cc_as_objc.m similarity index 100% rename from check/predef_check_cc_as_objc.m rename to tools/check/predef_check_cc_as_objc.m diff --git a/check/predef_check_cc_as_objcpp.mm b/tools/check/predef_check_cc_as_objcpp.mm similarity index 100% rename from check/predef_check_cc_as_objcpp.mm rename to tools/check/predef_check_cc_as_objcpp.mm