mirror of
https://github.com/boostorg/atomic.git
synced 2026-01-19 04:02:09 +00:00
This avoids the potential clash with another library that could make a similar check for <type_traits> but require a different set of type traits. b2 seems to use the string as part of the key in the config cache, so if the two different config checks have a matching description string it is unknown which check result is cached and used.
156 lines
4.5 KiB
Plaintext
156 lines
4.5 KiB
Plaintext
# Boost.Atomic Library Jamfile
|
|
#
|
|
# Copyright Helge Bahmann 2011.
|
|
# Copyright Andrey Semashev 2018, 2020-2025.
|
|
#
|
|
# 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/config/checks ;
|
|
|
|
import common ;
|
|
import config : requires ;
|
|
import path ;
|
|
import project ;
|
|
import feature ;
|
|
import configure ;
|
|
import atomic-arch-config ;
|
|
|
|
lib synchronization ;
|
|
explicit synchronization ;
|
|
|
|
local cxx_requirements = [ requires
|
|
cxx11_constexpr
|
|
cxx11_noexcept
|
|
cxx11_nullptr
|
|
cxx11_decltype
|
|
cxx11_decltype_n3276
|
|
cxx11_template_aliases
|
|
cxx11_static_assert
|
|
cxx11_rvalue_references
|
|
cxx11_scoped_enums
|
|
cxx11_defaulted_functions
|
|
cxx11_deleted_functions
|
|
cxx11_hdr_ratio
|
|
cxx11_hdr_chrono
|
|
]
|
|
[ check-target-builds ../config//has_cxx11_nontrivial_union "has unions with non-trivial members" : : <build>no ]
|
|
[ check-target-builds ../config//has_sufficient_cxx11_type_traits "has <type_traits> sufficient for Boost.Atomic" : : <build>no ]
|
|
;
|
|
|
|
project
|
|
: common-requirements
|
|
<include>../include
|
|
$(boost_dependencies)
|
|
: requirements
|
|
<library>/boost/align//boost_align
|
|
<library>/boost/preprocessor//boost_preprocessor
|
|
<include>../src
|
|
<threading>multi
|
|
<link>shared:<define>BOOST_ATOMIC_DYN_LINK=1
|
|
<link>static:<define>BOOST_ATOMIC_STATIC_LINK=1
|
|
<define>BOOST_ATOMIC_SOURCE
|
|
<target-os>windows:<define>BOOST_USE_WINDOWS_H
|
|
<toolset>gcc,<target-os>windows:<linkflags>"-lkernel32"
|
|
: usage-requirements
|
|
<link>shared:<define>BOOST_ATOMIC_DYN_LINK=1
|
|
<link>static:<define>BOOST_ATOMIC_STATIC_LINK=1
|
|
<define>BOOST_ATOMIC_NO_LIB=1
|
|
: source-location ../src
|
|
;
|
|
|
|
BOOST_ATOMIC_SOURCES_SSE2 =
|
|
find_address_sse2
|
|
;
|
|
|
|
BOOST_ATOMIC_SOURCES_SSE41 =
|
|
find_address_sse41
|
|
;
|
|
|
|
for local src in $(BOOST_ATOMIC_SOURCES_SSE2)
|
|
{
|
|
obj $(src)
|
|
: ## sources ##
|
|
$(src).cpp
|
|
: ## requirements ##
|
|
<conditional>@atomic-arch-config.sse2-flags
|
|
<link>shared:<define>BOOST_ATOMIC_DYN_LINK=1
|
|
<link>static:<define>BOOST_ATOMIC_STATIC_LINK=1
|
|
<define>BOOST_ATOMIC_SOURCE
|
|
;
|
|
|
|
explicit $(src) ;
|
|
}
|
|
|
|
for local src in $(BOOST_ATOMIC_SOURCES_SSE41)
|
|
{
|
|
obj $(src)
|
|
: ## sources ##
|
|
$(src).cpp
|
|
: ## requirements ##
|
|
<conditional>@atomic-arch-config.sse41-flags
|
|
<link>shared:<define>BOOST_ATOMIC_DYN_LINK=1
|
|
<link>static:<define>BOOST_ATOMIC_STATIC_LINK=1
|
|
<define>BOOST_ATOMIC_SOURCE
|
|
;
|
|
|
|
explicit $(src) ;
|
|
}
|
|
|
|
rule check-pthread-cond-clockwait ( properties * )
|
|
{
|
|
local result ;
|
|
|
|
local has_pthread_cond_clockwait = [ configure.builds ../config//has_pthread_cond_clockwait : $(properties) : "has pthread_cond_clockwait" ] ;
|
|
if $(has_pthread_cond_clockwait)
|
|
{
|
|
result = <define>BOOST_ATOMIC_HAS_PTHREAD_COND_CLOCKWAIT ;
|
|
}
|
|
|
|
return $(result) ;
|
|
}
|
|
|
|
rule select-arch-specific-sources ( properties * )
|
|
{
|
|
local result ;
|
|
|
|
if x86 in [ atomic-arch-config.deduce-architecture $(properties) ]
|
|
{
|
|
if [ configure.builds ../config//has_sse2 : $(properties) : "compiler supports SSE2" ]
|
|
{
|
|
result += <source>$(BOOST_ATOMIC_SOURCES_SSE2) ;
|
|
result += <define>BOOST_ATOMIC_USE_SSE2 ;
|
|
}
|
|
|
|
if [ configure.builds ../config//has_sse41 : $(properties) : "compiler supports SSE4.1" ]
|
|
{
|
|
result += <source>$(BOOST_ATOMIC_SOURCES_SSE41) ;
|
|
result += <define>BOOST_ATOMIC_USE_SSE41 ;
|
|
}
|
|
}
|
|
|
|
# ECHO "Arch sources: " $(result) ;
|
|
|
|
return $(result) ;
|
|
}
|
|
|
|
lib boost_atomic
|
|
: ## sources ##
|
|
lock_pool.cpp
|
|
: ## requirements ##
|
|
<include>../src
|
|
<conditional>@check-pthread-cond-clockwait
|
|
<conditional>@select-arch-specific-sources
|
|
<target-os>windows:<library>synchronization
|
|
# MinGW-w64 defines _WIN32_WINNT to _WIN32_WINNT_WS03 by default, which disables WaitOnAddress API that is required by Boost.Atomic.
|
|
# Define the macro ourselves to the Windows version required by Boost.Atomic.
|
|
# https://github.com/boostorg/atomic/issues/73
|
|
<toolset>gcc,<target-os>windows:<define>_WIN32_WINNT=0x0A00
|
|
$(cxx_requirements)
|
|
: usage-requirements
|
|
<target-os>windows:<library>synchronization
|
|
<toolset>gcc,<target-os>windows:<define>_WIN32_WINNT=0x0A00
|
|
$(cxx_requirements)
|
|
;
|