Update of /cvsroot/boost/boost/libs/thread/build
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30910

Modified Files:
      Tag: thread_rewrite
        Jamfile threads.jam 
Log Message:
bbv1 Jamfile restructured


Index: Jamfile
===================================================================
RCS file: /cvsroot/boost/boost/libs/thread/build/Jamfile,v
retrieving revision 1.36.4.3
retrieving revision 1.36.4.4
diff -u -d -r1.36.4.3 -r1.36.4.4
--- Jamfile     16 Jun 2006 13:40:30 -0000      1.36.4.3
+++ Jamfile     17 Jul 2006 10:15:17 -0000      1.36.4.4
@@ -10,97 +10,110 @@
 
 import ./threads ;
 
-#################
-# pthread library
-#################
+# The includes template can be used from an external project to work
+# around the broken path-global, thus avoiding reference to BOOST_ROOT.
+template includes : : <sysinclude>../../.. threads::lib-pthread ;
 
-CPP_SRC_PTHREAD =
-       thread
-       mutex
-       condition
-       exceptions
-       xtime
-       ;
+# pthreads is compiled on all platforms when available
+if [ threads::is-pthread-available ] {
+       
+       template pthread_base
+               : ## sources ##
+                 [ threads::cpp_source ../src/pthread :
+                   thread
+                   mutex
+                   condition
+                   exceptions
+                   xtime 
+                 ]
+               : ## requirements ##
+                 threads::lib-pthread
+                 <sysinclude>../../..
+                 <threading>multi
+                 <define>BOOST_THREAD_POSIX
+                 common-variant-tag
+                 <borland><*><cxxflags>-w-8004
+                 <borland><*><cxxflags>-w-8057
+               ;
 
-lib boost_thread_pthread
-       :  ../src/pthread/$(CPP_SRC_PTHREAD).cpp
-       : <sysinclude>$(BOOST_ROOT) 
-         <threading>multi 
-         common-variant-tag 
-         <define>BOOST_THREAD_BUILD_LIB=1
-         <define>BOOST_THREAD_POSIX
-         <borland><*><cxxflags>-w-8004
-         <borland><*><cxxflags>-w-8057
-         thread::require-pthread
-       : 
-       ;
+       lib boost_thread_pthread
+               : <template>pthread_base
+               : ## requirements ##    
+                 <define>BOOST_THREAD_BUILD_LIB=1
+               ;
 
-dll boost_thread_pthread
-       :  ../src/pthread/$(CPP_SRC_PTHREAD).cpp
-       : <sysinclude>$(BOOST_ROOT) 
-         <threading>multi 
-          <runtime-link>dynamic
-         common-variant-tag 
-         <define>BOOST_THREAD_BUILD_DLL=1
-         <define>BOOST_THREAD_POSIX
-         <borland><*><cxxflags>-w-8004
-         <borland><*><cxxflags>-w-8057
-         thread::require-pthread
-       : 
-       ;
+       dll boost_thread_pthread
+               : <template>pthread_base
+               : ## requirements ##
+                 <runtime-link>dynamic
+                 <define>BOOST_THREAD_BUILD_DLL=1
+               ;
 
-stage bin-stage
-    : <dll>boost_thread_pthread
-      <lib>boost_thread_pthread
-       ;
+       stage bin-stage
+               : <dll>boost_thread_pthread
+                 <lib>boost_thread_pthread
+               ;
 
-install thread_pthread lib
-    : <dll>boost_thread_pthread
-      <lib>boost_thread_pthread
-       ;
+       install thread_pthread lib
+               : <dll>boost_thread_pthread
+                 <lib>boost_thread_pthread
+               ;
 
-###############
-# win32 library
-###############
+       # the next is true on platforms where pthreads is native threading lib
+       if [ threads::is-native-on-build-os pthread ] {
+       
+               lib boost_thread
+                       : <template>pthread_base
+                       : ## requirements ##    
+                         <define>BOOST_THREAD_BUILD_LIB=1
+                       ;
 
-CPP_SRC_WIN32 =
-       thread
-       exceptions
-        xtime
-       ;
+               dll boost_thread
+                       : <template>pthread_base
+                       : ## requirements ##
+                         <runtime-link>dynamic
+                         <define>BOOST_THREAD_BUILD_DLL=1
+                       ;
+       }
+}
 
-lib boost_thread_win32
-       :  ../src/win32/$(CPP_SRC_WIN32).cpp
-       : <sysinclude>$(BOOST_ROOT) 
-         <threading>multi 
-         common-variant-tag 
-         <define>BOOST_THREAD_BUILD_LIB=1
-         <borland><*><cxxflags>-w-8004
-         <borland><*><cxxflags>-w-8057
-         thread::require-win32
-       : 
-       ;
+if [ threads::is-native-on-build-os win32 ] {
 
-dll boost_thread_win32
-       :  ../src/win32/$(CPP_SRC_WIN32).cpp
-       : <sysinclude>$(BOOST_ROOT) 
-         <threading>multi 
-          <runtime-link>dynamic
-         common-variant-tag 
-         <define>BOOST_THREAD_BUILD_DLL=1
-         <borland><*><cxxflags>-w-8004
-         <borland><*><cxxflags>-w-8057
-         thread::require-win32
-       : 
-       ;
+       template win32_base
+               : ## sources ##
+                 [ threads::cpp_source ../src/win32 :
+                   thread
+                   exceptions
+                   xtime 
+                 ]
+               : ## requirements ##
+                 <sysinclude>../../..
+                 <threading>multi
+                 common-variant-tag
+                 <borland><*><cxxflags>-w-8004
+                 <borland><*><cxxflags>-w-8057
+               ;
+
+       lib boost_thread
+               : <template>win32_base
+               : ## requirements ##    
+                 <define>BOOST_THREAD_BUILD_LIB=1
+               ;
+
+       dll boost_thread
+               : <template>win32_base
+               : ## requirements ##
+                         <runtime-link>dynamic
+                 <define>BOOST_THREAD_BUILD_DLL=1
+               ;
+}
 
 stage bin-stage
-       : <dll>boost_thread_win32
-          <lib>boost_thread_win32
+       : <dll>boost_thread
+         <lib>boost_thread
        ;
 
-install thread_win32 lib
-       : <dll>boost_thread_win32
-          <lib>boost_thread_win32
-       ;
-
+install thread lib
+       : <dll>boost_thread
+         <lib>boost_thread
+       ;

Index: threads.jam
===================================================================
RCS file: /cvsroot/boost/boost/libs/thread/build/threads.jam,v
retrieving revision 1.13.8.1
retrieving revision 1.13.8.2
diff -u -d -r1.13.8.1 -r1.13.8.2
--- threads.jam 11 Apr 2006 19:24:06 -0000      1.13.8.1
+++ threads.jam 17 Jul 2006 10:15:17 -0000      1.13.8.2
@@ -6,35 +6,60 @@
 # This work is a reimplementation along the design and ideas
 # of William E. Kempf.
 
-rule thread::require-pthread ( toolset variant : subvariant-path properties * )
+# find out if pthread is available on current build platform
+rule threads::is-pthread-available
 {
-# default is to assume pthread beeing available
-# platforms known not to support it are disabled
-# explicitely
-
-        local build = true ;
-
-        if $(OS) = "NT" {
-               if $(PTW32_INCLUDE) && $(PTW32_LIB) {
-                       properties = [ impose-requirements $(properties) :
-                                                      
<define>BOOST_HAS_PTHREADS
-                                                      <include>$(PTW32_INCLUDE)
-                                                      
<library-file>$(PTW32_LIB)/pthreadVC2.lib ] ;
-                }
-                else build = false ;
-        }
+       if $(OS) = "NT" {
+               if $(PTW32_INCLUDE) && $(PTW32_LIB) {
+                       return true ;
+               }
+               else {
+                       ECHO 
"******************************************************" ;
+                       ECHO "Building Boost.Thread without pthread support" ;
+                       ECHO "If you need pthread you should specify the 
paths." ;
+                       ECHO "For example:" ;
+                       ECHO "PTW32_INCLUDE=C:\\Program 
Files\\ptw32\\Pre-built2\\include" ;
+                       ECHO "PTW32_LIB=C:\\Program 
Files\\ptw32\\Pre-built2\\lib\\pthreadVC2.lib" ;
+                       ECHO 
"******************************************************" ;
+               }
+       }
+       else if $(OS) = "LINUX" {
+               return true ;
+       }
+       else { ## assume pthread is available on unknown os for now
+               return true ;
+       }
+}
 
-        if $(build) = false {
-            properties = [ impose-requirements $(properties) : <build>no ] ;
-        }
+# find the native library variant for current build os
+rule threads::is-native-on-build-os ( libvariant )
+{
+       if      $(OS) = "NT" {
+               if $(libvariant) = win32 { return true ; }
+       }
+       else if $(OS) = "LINUX" {
+               if $(libvariant) = pthread { return true ; }
+       }
+       else { ## assume pthread is native on others for now
+               if $(libvariant) = pthread { return true ; }
+       }
+}
 
-        return $(subvariant-path) $(properties) ;
+# utility to prepend the source path to the cpp sources
+rule threads::cpp_source ( path : sources * )
+{
+       return $(path)/$(sources).cpp ;
 }
 
-rule thread::require-win32 ( toolset variant : subvariant-path properties * )
+# impose the pthread library and include path on the requirements
+rule threads::lib-pthread ( toolset variant : subvariant-path properties * )
 {
-        if $(OS) != "NT" {
-               properties = [ impose-requirements $(properties) : <build>no ] ;
-       }
+        if $(OS) = "NT" &&  $(PTW32_INCLUDE) && $(PTW32_LIB) {
+               properties = [ impose-requirements $(properties) :
+                       <define>BOOST_HAS_PTHREADS
+                       <include>$(PTW32_INCLUDE)
+                       <library-file>$(PTW32_LIB) ] ;
+        }
+        
        return $(subvariant-path) $(properties) ;
 }



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to