Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84174 - trunk/libs/log/build
From: andrey.semashev_at_[hidden]
Date: 2013-05-06 15:26:19


Author: andysem
Date: 2013-05-06 15:26:18 EDT (Mon, 06 May 2013)
New Revision: 84174
URL: http://svn.boost.org/trac/boost/changeset/84174

Log:
Worked around Boost.Build failure in 32 bit MSVC builds.
Added:
   trunk/libs/log/build/log-architecture.jam
      - copied, changed from r84169, /trunk/libs/log/build/architecture.jam
Removed:
   trunk/libs/log/build/architecture.jam
Text files modified:
   trunk/libs/log/build/Jamfile.v2 | 49 +++++++++++++++-------------
   trunk/libs/log/build/log-architecture.jam | 66 +++++++++++++++++++++++++++++----------
   2 files changed, 75 insertions(+), 40 deletions(-)

Modified: trunk/libs/log/build/Jamfile.v2
==============================================================================
--- trunk/libs/log/build/Jamfile.v2 (original)
+++ trunk/libs/log/build/Jamfile.v2 2013-05-06 15:26:18 EDT (Mon, 06 May 2013)
@@ -11,7 +11,7 @@
 import feature ;
 import version ;
 import property ;
-import architecture ;
+import log-architecture ;
 using mc ;
 
 lib psapi ;
@@ -27,29 +27,31 @@
 feature.feature logapi : unix winnt : propagated ;
 feature.set-default logapi : [ default_logapi ] ;
 
-rule select-instruction-set ( properties * )
+rule select-instruction-set-flags ( properties * )
 {
     local result ;
+ local instruction_set = [ feature.get-values "log-instruction-set" : $(properties) ] ;
 
- if <architecture>x86 in $(properties) && <address-model>32 in $(properties)
+ if $(instruction_set) = i386 || $(instruction_set) = i486
     {
- result = [ property.select <instruction-set> : $(properties) ] ;
- if $(result)
+ if ! $(.annouced-failure)
         {
- if $(result) = <instruction-set>i386 || $(result) = <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 ;
- }
+ 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 ;
+ }
+ else if $(instruction_set) = i686 && ! <instruction-set> in $(properties)
+ {
+ # We override the default <instruction-set> (which is i386 in this case) with our custom compiler flags.
+ # This hack is needed because Boost.Build fails to configure dependencies of this library if we modify <instruction-set> property.
+ if <toolset>gcc in $(properties) || <toolset>clang in $(properties) || <toolset>intel-linux in $(properties) || <toolset>intel-darwin in $(properties)
+ {
+ result = <cxxflags>"-march=i686" ;
         }
- else
+ else if <toolset>msvc-7.1 in $(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 = <instruction-set>i686 ;
+ result = <cxxflags>"/G6" ;
         }
     }
 
@@ -59,9 +61,10 @@
 project boost/log
     : source-location ../src
     : requirements
- [ architecture.architecture ]
- [ architecture.address-model ]
- <conditional>@select-instruction-set
+ [ log-architecture.architecture ]
+ [ log-architecture.address-model ]
+ [ log-architecture.instruction-set ]
+ <conditional>@select-instruction-set-flags
         <define>BOOST_SPIRIT_USE_PHOENIX_V3=1
         <define>BOOST_THREAD_DONT_USE_CHRONO=1 # Don't introduce false dependency on Boost.Chrono
         <logapi>unix:<define>BOOST_LOG_USE_NATIVE_SYSLOG=1
@@ -143,7 +146,7 @@
 {
     local result = <build>no ;
 
- if <architecture>x86 in $(properties)
+ if <log-architecture>x86 in $(properties)
     {
         if <toolset>gcc in $(properties)
         {
@@ -164,7 +167,7 @@
             {
                 # MSVC doesn't really care about these switches, all SSE intrinsics are always available, but still...
                 # Also 64 bit MSVC doesn't have the /arch:SSE2 switch as it is the default.
- if <address-model>32 in $(properties)
+ if <log-address-model>32 in $(properties)
                 {
                     result = <cxxflags>"/arch:SSE2" ;
                 }
@@ -240,7 +243,7 @@
 {
     local result = <build>no ;
 
- if <architecture>x86 in $(properties)
+ if <log-architecture>x86 in $(properties)
     {
         if <toolset>gcc in $(properties)
         {

Deleted: trunk/libs/log/build/architecture.jam
==============================================================================
--- trunk/libs/log/build/architecture.jam 2013-05-06 15:26:18 EDT (Mon, 06 May 2013)
+++ (empty file)
@@ -1,80 +0,0 @@
-# architecture.jam
-#
-# Copyright 2012 Steven Watanabe
-#
-# 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 configure ;
-import project ;
-import path ;
-import property ;
-
-local here = [ modules.binding $(__name__) ] ;
-
-project.push-current [ project.current ] ;
-project.load [ path.join [ path.make $(here:D) ] ../config ] ;
-project.pop-current ;
-
-rule deduce-address-model ( properties * )
-{
- local result = [ property.select <address-model> : $(properties) ] ;
- if $(result)
- {
- return $(result) ;
- }
- else
- {
- if [ configure.builds /boost/architecture//32 : $(properties) : 32-bit ]
- {
- return <address-model>32 ;
- }
- else if [ configure.builds /boost/architecture//64 : $(properties) : 64-bit ]
- {
- return <address-model>64 ;
- }
- }
-}
-
-rule address-model ( )
-{
- return <conditional>@architecture.deduce-address-model ;
-}
-
-rule deduce-architecture ( properties * )
-{
- local result = [ property.select <architecture> : $(properties) ] ;
- if $(result)
- {
- return $(result) ;
- }
- else
- {
- if [ configure.builds /boost/architecture//x86 : $(properties) : x86 ]
- {
- return <architecture>x86 ;
- }
- else if [ configure.builds /boost/architecture//arm : $(properties) : arm ]
- {
- return <architecture>arm ;
- }
- else if [ configure.builds /boost/architecture//mips1 : $(properties) : mips1 ]
- {
- return <architecture>mips1 ;
- }
- else if [ configure.builds /boost/architecture//power : $(properties) : power ]
- {
- return <architecture>power ;
- }
- else if [ configure.builds /boost/architecture//sparc : $(properties) : sparc ]
- {
- return <architecture>sparc ;
- }
- }
-}
-
-rule architecture ( )
-{
- return <conditional>@architecture.deduce-architecture ;
-}

Copied: trunk/libs/log/build/log-architecture.jam (from r84169, /trunk/libs/log/build/architecture.jam)
==============================================================================
--- /trunk/libs/log/build/architecture.jam (original)
+++ trunk/libs/log/build/log-architecture.jam 2013-05-06 15:26:18 EDT (Mon, 06 May 2013)
@@ -1,6 +1,7 @@
-# architecture.jam
+# log-architecture.jam
 #
 # Copyright 2012 Steven Watanabe
+# Copyright 2013 Andrey Semashev
 #
 # Distributed under the Boost Software License Version 1.0. (See
 # accompanying file LICENSE_1_0.txt or copy at
@@ -10,71 +11,102 @@
 import project ;
 import path ;
 import property ;
+import feature ;
 
 local here = [ modules.binding $(__name__) ] ;
 
+feature.feature log-architecture : : free ;
+feature.feature log-address-model : : free ;
+feature.feature log-instruction-set : : free ;
+
 project.push-current [ project.current ] ;
-project.load [ path.join [ path.make $(here:D) ] ../config ] ;
+project.load [ path.join [ path.make $(here:D) ] ../../context/config ] ;
 project.pop-current ;
 
 rule deduce-address-model ( properties * )
 {
- local result = [ property.select <address-model> : $(properties) ] ;
- if $(result)
+ local address_model = [ feature.get-values "address-model" : $(properties) ] ;
+ if $(address_model)
     {
- return $(result) ;
+ return <log-address-model>$(address_model) ;
     }
     else
     {
         if [ configure.builds /boost/architecture//32 : $(properties) : 32-bit ]
         {
- return <address-model>32 ;
+ return <log-address-model>32 ;
         }
         else if [ configure.builds /boost/architecture//64 : $(properties) : 64-bit ]
         {
- return <address-model>64 ;
+ return <log-address-model>64 ;
         }
     }
 }
 
 rule address-model ( )
 {
- return <conditional>@architecture.deduce-address-model ;
+ return <conditional>@log-architecture.deduce-address-model ;
 }
 
 rule deduce-architecture ( properties * )
 {
- local result = [ property.select <architecture> : $(properties) ] ;
- if $(result)
+ local architecture = [ feature.get-values "architecture" : $(properties) ] ;
+ if $(architecture)
     {
- return $(result) ;
+ return <log-architecture>$(architecture) ;
     }
     else
     {
         if [ configure.builds /boost/architecture//x86 : $(properties) : x86 ]
         {
- return <architecture>x86 ;
+ return <log-architecture>x86 ;
         }
         else if [ configure.builds /boost/architecture//arm : $(properties) : arm ]
         {
- return <architecture>arm ;
+ return <log-architecture>arm ;
         }
         else if [ configure.builds /boost/architecture//mips1 : $(properties) : mips1 ]
         {
- return <architecture>mips1 ;
+ return <log-architecture>mips1 ;
         }
         else if [ configure.builds /boost/architecture//power : $(properties) : power ]
         {
- return <architecture>power ;
+ return <log-architecture>power ;
         }
         else if [ configure.builds /boost/architecture//sparc : $(properties) : sparc ]
         {
- return <architecture>sparc ;
+ return <log-architecture>sparc ;
         }
     }
 }
 
 rule architecture ( )
 {
- return <conditional>@architecture.deduce-architecture ;
+ return <conditional>@log-architecture.deduce-architecture ;
+}
+
+rule deduce-instruction-set ( properties * )
+{
+ local result ;
+ local instruction_set = [ feature.get-values "instruction-set" : $(properties) ] ;
+
+ if $(instruction_set)
+ {
+ result = <log-instruction-set>$(instruction_set) ;
+ }
+ else
+ {
+ if <log-architecture>x86 in $(properties) && <log-address-model>32 in $(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 = <log-instruction-set>i686 ;
+ }
+ }
+
+ return $(result) ;
+}
+
+rule instruction-set ( )
+{
+ return <conditional>@log-architecture.deduce-instruction-set ;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk