1# Boost.Atomic Library Jamfile 2# 3# Copyright Helge Bahmann 2011. 4# Copyright Andrey Semashev 2018, 2020. 5# 6# Distributed under the Boost Software License, Version 1.0. 7# (See accompanying file LICENSE_1_0.txt or copy at 8# http://www.boost.org/LICENSE_1_0.txt) 9 10import common ; 11import path ; 12import project ; 13import feature ; 14import configure ; 15import atomic-arch-config ; 16 17local here = [ modules.binding $(__name__) ] ; 18 19project.push-current [ project.current ] ; 20project.load [ path.join [ path.make $(here:D) ] ../../config/checks/architecture ] ; 21project.pop-current ; 22 23lib synchronization ; 24explicit synchronization ; 25 26project boost/atomic 27 : requirements 28 <threading>multi 29 <link>shared:<define>BOOST_ATOMIC_DYN_LINK=1 30 <link>static:<define>BOOST_ATOMIC_STATIC_LINK=1 31 <define>BOOST_ATOMIC_SOURCE 32 <target-os>windows:<define>BOOST_USE_WINDOWS_H 33 <toolset>gcc,<target-os>windows:<linkflags>"-lkernel32" 34 : usage-requirements 35 <link>shared:<define>BOOST_ATOMIC_DYN_LINK=1 36 <link>static:<define>BOOST_ATOMIC_STATIC_LINK=1 37 : source-location ../src 38 ; 39 40BOOST_ATOMIC_SOURCES_SSE2 = 41 find_address_sse2 42; 43 44BOOST_ATOMIC_SOURCES_SSE41 = 45 find_address_sse41 46; 47 48for local src in $(BOOST_ATOMIC_SOURCES_SSE2) 49{ 50 obj $(src) 51 : ## sources ## 52 $(src).cpp 53 : ## requirements ## 54 <conditional>@atomic-arch-config.sse2-flags 55 <link>shared:<define>BOOST_ATOMIC_DYN_LINK=1 56 <link>static:<define>BOOST_ATOMIC_STATIC_LINK=1 57 <define>BOOST_ATOMIC_SOURCE 58 ; 59 60 explicit $(src) ; 61} 62 63for local src in $(BOOST_ATOMIC_SOURCES_SSE41) 64{ 65 obj $(src) 66 : ## sources ## 67 $(src).cpp 68 : ## requirements ## 69 <conditional>@atomic-arch-config.sse41-flags 70 <link>shared:<define>BOOST_ATOMIC_DYN_LINK=1 71 <link>static:<define>BOOST_ATOMIC_STATIC_LINK=1 72 <define>BOOST_ATOMIC_SOURCE 73 ; 74 75 explicit $(src) ; 76} 77 78rule select-arch-specific-sources ( properties * ) 79{ 80 local result ; 81 82 if x86 in [ atomic-arch-config.deduce-architecture $(properties) ] 83 { 84 if [ configure.builds ../config//has_sse2 : $(properties) : "compiler supports SSE2" ] 85 { 86 result += <source>$(BOOST_ATOMIC_SOURCES_SSE2) ; 87 result += <define>BOOST_ATOMIC_USE_SSE2 ; 88 } 89 90 if [ configure.builds ../config//has_sse41 : $(properties) : "compiler supports SSE4.1" ] 91 { 92 result += <source>$(BOOST_ATOMIC_SOURCES_SSE41) ; 93 result += <define>BOOST_ATOMIC_USE_SSE41 ; 94 } 95 } 96 97# ECHO "Arch sources: " $(result) ; 98 99 return $(result) ; 100} 101 102rule select-platform-specific-sources ( properties * ) 103{ 104 local result ; 105 106 if <target-os>windows in $(properties) 107 { 108 result += <source>wait_ops_windows.cpp ; 109 110 if [ configure.builds ../config//has_synchronization : $(properties) : "has synchronization.lib" ] 111 { 112 result += <library>synchronization ; 113 } 114 } 115 116# ECHO Platform sources: $(result) ; 117 118 return $(result) ; 119} 120 121lib boost_atomic 122 : ## sources ## 123 lock_pool.cpp 124 : ## requirements ## 125 <include>../src 126 <conditional>@select-arch-specific-sources 127 <conditional>@select-platform-specific-sources 128 ; 129 130boost-install boost_atomic ; 131