mirror of https://github.com/CGAL/cgal
CGAL_Core no longer needs Boost.Thread
This commit is contained in:
parent
e2e623c8a7
commit
8a7d3fa21e
|
|
@ -26,14 +26,6 @@
|
|||
|
||||
#include <CGAL/config.h>
|
||||
#include <CGAL/tss.h>
|
||||
#include <boost/config.hpp>
|
||||
#if defined(CGAL_HAS_THREADS) && defined(BOOST_GCC) && BOOST_GCC < 90100
|
||||
// Force the use of Boost.Thread with g++ and C++11, because of the PR66944
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66944
|
||||
// See also CGAL PR #1888
|
||||
// https://github.com/CGAL/cgal/pull/1888#issuecomment-278284232
|
||||
# include <boost/thread/tss.hpp>
|
||||
#endif
|
||||
|
||||
#include <new> // for placement new
|
||||
#include <cassert>
|
||||
|
|
@ -85,10 +77,7 @@ public:
|
|||
|
||||
// Access the corresponding static global allocator.
|
||||
static MemoryPool<T,nObjects>& global_allocator() {
|
||||
#if defined(CGAL_HAS_THREADS) && defined(BOOST_GCC) && BOOST_GCC < 90100
|
||||
if(memPool_ptr.get() == nullptr) {memPool_ptr.reset(new Self());}
|
||||
Self& memPool = * memPool_ptr.get();
|
||||
#elif defined(CGAL_HAS_THREADS) // use the C++11 implementation
|
||||
#if defined(CGAL_HAS_THREADS) // use the C++11 implementation
|
||||
static thread_local Self memPool;
|
||||
#else // not CGAL_HAS_THREADS
|
||||
static Self memPool;
|
||||
|
|
@ -99,18 +88,8 @@ public:
|
|||
private:
|
||||
Thunk* head; // next available block in the pool
|
||||
std::vector<void*> blocks;
|
||||
|
||||
#if defined(CGAL_HAS_THREADS) && defined(BOOST_GCC) && BOOST_GCC < 90100
|
||||
static boost::thread_specific_ptr<Self> memPool_ptr;
|
||||
#endif // not CGAL_HAS_THREADS
|
||||
};
|
||||
|
||||
#if defined(CGAL_HAS_THREADS) && defined(BOOST_GCC) && BOOST_GCC < 90100
|
||||
template <class T, int nObjects >
|
||||
boost::thread_specific_ptr<MemoryPool<T, nObjects> >
|
||||
MemoryPool<T, nObjects>::memPool_ptr;
|
||||
#endif
|
||||
|
||||
template< class T, int nObjects >
|
||||
void* MemoryPool< T, nObjects >::allocate(std::size_t) {
|
||||
if ( head == 0 ) { // if no more memory in the pool
|
||||
|
|
|
|||
|
|
@ -64,10 +64,6 @@ installed as binaries.
|
|||
|
||||
\cgal only requires the headers of the \sc{Boost} libraries, but some demos and examples
|
||||
depend on the binary library `Boost.Program_options`.
|
||||
As an exception and because of a bug in the \gcc compiler about the \cpp 11
|
||||
keyword `thread_local`, the `CGAL_Core` library always requires
|
||||
the binary library `Boost.Thread` if the \gcc compiler version 9.0 or
|
||||
earlier is used.
|
||||
|
||||
In case the \sc{Boost} libraries are not installed on your system already, you
|
||||
can obtain them from <A HREF="https://www.boost.org">`https://www.boost.org/`</A>.
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ Release date: July 2020
|
|||
|
||||
See also the associated [blog entry](https://www.cgal.org/2020/04/20/Optimal_bounding_box/).
|
||||
|
||||
### Installation
|
||||
|
||||
- The CGAL\_Core library no longer requires `Boost.Thread`, even if the g++ compiler is used.
|
||||
|
||||
### [Tutorials](https://doc.cgal.org/5.1/Manual/tutorials.html)
|
||||
|
||||
- Two new, detailed tutorials have been added:
|
||||
|
|
|
|||
|
|
@ -53,13 +53,6 @@ endif()
|
|||
# keyword, or ``PUBLIC`` otherwise.
|
||||
#
|
||||
|
||||
# See the release notes of CGAL-4.10: CGAL_Core now requires
|
||||
# Boost.Thread, with GNU G++ < 9.1.
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_TweakFindBoost.cmake)
|
||||
find_package( Boost 1.48 REQUIRED COMPONENTS thread system )
|
||||
endif()
|
||||
|
||||
function(CGAL_setup_CGAL_Core_dependencies target)
|
||||
if(ARGV1 STREQUAL INTERFACE)
|
||||
set(keyword INTERFACE)
|
||||
|
|
@ -71,20 +64,4 @@ function(CGAL_setup_CGAL_Core_dependencies target)
|
|||
target_compile_definitions(${target} ${keyword} CGAL_USE_CORE=1)
|
||||
target_link_libraries( CGAL_Core ${keyword} CGAL::CGAL )
|
||||
|
||||
# See the release notes of CGAL-4.10: CGAL_Core now requires
|
||||
# Boost.Thread, with GNU G++.
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1)
|
||||
if(TARGET Boost::thread)
|
||||
target_link_libraries( CGAL_Core ${keyword} Boost::thread)
|
||||
else()
|
||||
# Note that `find_package( Boost...)` must be called in the
|
||||
# function `CGAL_setup_CGAL_Core_dependencies()` because the
|
||||
# calling `CMakeLists.txt` may also call `find_package(Boost)`
|
||||
# between the inclusion of this module, and the call to this
|
||||
# function. That resets `Boost_LIBRARIES`.
|
||||
find_package( Boost 1.48 REQUIRED thread system )
|
||||
target_link_libraries( CGAL_Core ${keyword} ${Boost_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
|
|
|||
Loading…
Reference in New Issue