diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 24ab40bec..734203426 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -17,6 +17,8 @@ import config : requires ; import log-arch-config ; import log-platform-config ; import log-build-config ; +import-search /boost/predef/tools ; +import predef ; using mc ; @@ -64,6 +66,7 @@ project : common-requirements $(boost_dependencies) : requirements $(boost_dependencies_private) + @log-arch-config.check-instruction-set @log-build-config.check-atomic-int32 @log-build-config.select-regex-backend @log-build-config.check-pthread-mutex-robust @@ -132,6 +135,10 @@ project freebsd:rt qnxnto:socket pgi:rt + + # Set these to computed values according to the build. + [ predef.address-model ] + [ predef.architecture ] : usage-requirements clang:-Wno-bind-to-temporary-copy clang:-Wno-unused-function diff --git a/build/log-arch-config.jam b/build/log-arch-config.jam index a521f830b..b5438ff00 100644 --- a/build/log-arch-config.jam +++ b/build/log-arch-config.jam @@ -13,8 +13,42 @@ import path ; import property ; import feature ; +rule deduce-address-model ( properties * ) +{ + # The address-model is always set to a deduced value using the predef.address-model checks. + return [ feature.get-values : $(properties) ] ; +} + +rule deduce-architecture ( properties * ) +{ + # The architecture is always set to a deduced value using the predef.architecture checks. + return [ feature.get-values : $(properties) ] ; +} + +rule deduce-instruction-set ( properties * ) +{ + local result ; + local instruction_set = [ feature.get-values : $(properties) ] ; + + if $(instruction_set) + { + result = $(instruction_set) ; + } + else + { + if x86 in [ deduce-architecture $(properties) ] && 32 in [ deduce-address-model $(properties) ] + { + # We build for Pentium Pro and later CPUs by default. This is used as the target in many Linux distributions, and Windows and OS X also seem to not support older CPUs. + result = i686 ; + } + } + + return $(result) ; +} + rule ssse3-flags ( properties * ) { + local result ; if intel in $(properties) { if win in $(properties) @@ -76,4 +110,18 @@ rule avx2-flags ( properties * ) rule check-instruction-set ( properties * ) { + local result ; + local instruction_set = [ log-arch-config.deduce-instruction-set $(properties) ] ; + + if $(instruction_set) = i386 || $(instruction_set) = i486 + { + if ! $(.annouced-failure) + { + ECHO Boost.Log is not supported on the specified target CPU and will not be built. At least i586 class CPU is required. ; + .annouced-failure = 1 ; + } + result = no ; + } + + return $(result) ; } diff --git a/config/build.jam b/config/build.jam index e69de29bb..116fca8b2 100644 --- a/config/build.jam +++ b/config/build.jam @@ -0,0 +1,14 @@ +# Copyright René Ferdinand Rivera Morell +# 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) + +import-search /boost/predef/tools ; +import predef ; + +project + : requirements + # Set these to computed values according to the build. + [ predef.address-model ] + [ predef.architecture ] + ; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 33485c02e..ed5a616a6 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -72,9 +72,10 @@ rule test_all if ! [ os.environ BOOST_LOG_TEST_WITHOUT_SELF_CONTAINED_HEADER_TESTS ] { - for file in [ glob-tree-ex ../include/boost/log : *.hpp : detail ] + local headers_path = ../include/boost/log ; + for file in [ glob-tree-ex $(headers_path) : *.hpp : detail ] { - local rel_file = [ path.relative-to ../include/boost/log $(file) ] ; + local rel_file = [ path.relative-to $(headers_path) $(file) ] ; # Note: The test name starts with '~' in order to group these tests in the test report table, preferably at the end. # All '/' are replaced with '-' because apparently test scripts have a problem with test names containing slashes. local test_name = [ regex.replace ~hdr/$(rel_file) "/" "-" ] ;