Skip to content

Commit

Permalink
Set default address-model and architecture to avoid extra/custom dete…
Browse files Browse the repository at this point in the history
…ction logic. Put back missing check and config rules.
  • Loading branch information
grafikrobot committed Jul 25, 2024
1 parent c3f43bc commit 3d42a6c
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
7 changes: 7 additions & 0 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;

Expand Down Expand Up @@ -64,6 +66,7 @@ project
: common-requirements <library>$(boost_dependencies)
: requirements
<library>$(boost_dependencies_private)
<conditional>@log-arch-config.check-instruction-set
<conditional>@log-build-config.check-atomic-int32
<conditional>@log-build-config.select-regex-backend
<conditional>@log-build-config.check-pthread-mutex-robust
Expand Down Expand Up @@ -132,6 +135,10 @@ project
<target-os>freebsd:<library>rt
<target-os>qnxnto:<library>socket
<toolset>pgi:<library>rt

# Set these to computed values according to the build.
[ predef.address-model ]
[ predef.architecture ]
: usage-requirements
<toolset>clang:<cxxflags>-Wno-bind-to-temporary-copy
<toolset>clang:<cxxflags>-Wno-unused-function
Expand Down
48 changes: 48 additions & 0 deletions build/log-arch-config.jam
Original file line number Diff line number Diff line change
Expand Up @@ -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 <address-model> : $(properties) ] ;
}

rule deduce-architecture ( properties * )
{
# The architecture is always set to a deduced value using the predef.architecture checks.
return [ feature.get-values <architecture> : $(properties) ] ;
}

rule deduce-instruction-set ( properties * )
{
local result ;
local instruction_set = [ feature.get-values <instruction-set> : $(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 <toolset>intel in $(properties)
{
if <toolset-intel:platform>win in $(properties)
Expand Down Expand Up @@ -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 = <build>no ;
}

return $(result) ;
}
14 changes: 14 additions & 0 deletions config/build.jam
Original file line number Diff line number Diff line change
@@ -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 ]
;
5 changes: 3 additions & 2 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -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) "/" "-" ] ;
Expand Down

0 comments on commit 3d42a6c

Please sign in to comment.