Skip to content

Commit a847cb7

Browse files
committed
Partial fix for issue #317 in v3.7.0.
When Boost 1.65.0 or higher is used, we'll rely on C++11 for smart pointers instead of the `boost/tr1/*.hpp` headers.
1 parent 2be93aa commit a847cb7

File tree

7 files changed

+56
-16
lines changed

7 files changed

+56
-16
lines changed

source/backend/precomp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
///
3434
//******************************************************************************
3535

36+
#include "base/configbase.h"
37+
3638
#include <algorithm>
3739
#include <cassert>
3840
#include <cctype>
@@ -64,6 +66,4 @@
6466
#include <boost/thread.hpp>
6567
#include <boost/thread/condition.hpp>
6668
#include <boost/unordered_map.hpp>
67-
#include <boost/tr1/memory.hpp>
68-
69-
69+
//#include <boost/tr1/memory.hpp> // now pulled in by "base/configbase.h"

source/base/image/colourspace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ SimpleGammaCurvePtr PowerLawGammaCurve::GetByEncodingGamma(float gamma)
247247
{
248248
if (IsNeutral(gamma))
249249
return NeutralGammaCurve::Get();
250-
return std::tr1::dynamic_pointer_cast<SimpleGammaCurve,GammaCurve>(GetMatching(GammaCurvePtr(new PowerLawGammaCurve(gamma))));
250+
return POV_TR1_NAMESPACE::dynamic_pointer_cast<SimpleGammaCurve,GammaCurve>(GetMatching(GammaCurvePtr(new PowerLawGammaCurve(gamma))));
251251
}
252252
SimpleGammaCurvePtr PowerLawGammaCurve::GetByDecodingGamma(float gamma)
253253
{

source/base/precomp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
///
3434
//******************************************************************************
3535

36+
#include "base/configbase.h"
37+
3638
#include <algorithm>
3739
#include <cassert>
3840
#include <cctype>
@@ -64,6 +66,4 @@
6466
#include <boost/thread.hpp>
6567
#include <boost/thread/condition.hpp>
6668
#include <boost/unordered_map.hpp>
67-
#include <boost/tr1/memory.hpp>
68-
69-
69+
//#include <boost/tr1/memory.hpp> // now pulled in by "base/configbase.h"

source/frontend/precomp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
///
3434
//******************************************************************************
3535

36+
#include "base/configbase.h"
37+
3638
#include <algorithm>
3739
#include <cassert>
3840
#include <cctype>
@@ -64,6 +66,4 @@
6466
#include <boost/thread.hpp>
6567
#include <boost/thread/condition.hpp>
6668
#include <boost/unordered_map.hpp>
67-
#include <boost/tr1/memory.hpp>
68-
69-
69+
//#include <boost/tr1/memory.hpp> // now pulled in by "base/configbase.h"

unix/install.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ recommanded to generate a fully-featured POV-Ray executable.
136136
http://www.libsdl.org
137137

138138

139+
2.4 Compatibility Issues
140+
====================
141+
142+
- We currently do not support Boost 1.65 or above unless a C++11-compliant
143+
compiler is used.
144+
145+
139146
====================================================
140147
3. Configuring, building, and (un)installing POV-Ray
141148
====================================================

vfe/unix/syspovconfig.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,20 @@ using std::min;
6666
#include <string>
6767
#include <vector>
6868
#include <list>
69-
#include <boost/tr1/memory.hpp>
69+
70+
#include <boost/version.hpp>
71+
#if BOOST_VERSION < 106500
72+
// Pulling in smart pointers is easy with Boost versions prior to 1.65.0, with the
73+
// `boost/tr1/*.hpp` set of headers simply pulling in whatever is available (C++11, TR1 or
74+
// boost's own implementation) and making it available in the `std::tr1` namespace.
75+
#include <boost/tr1/memory.hpp>
76+
#define POV_TR1_NAMESPACE std::tr1
77+
#else
78+
// With `boost/tr1/*.hpp` unavailable, we're currently blindly relying on the compiler to
79+
// be compliant with C++11.
80+
#include <memory>
81+
#define POV_TR1_NAMESPACE std
82+
#endif
7083

7184
// when we say 'string' we mean std::string
7285
using std::string;
@@ -82,8 +95,11 @@ using std::list;
8295
using std::runtime_error;
8396

8497
// these may actually be the boost implementations, depending on what boost/tr1/memory.hpp has pulled in
85-
using std::tr1::shared_ptr;
86-
using std::tr1::weak_ptr;
98+
// (NOTE: If you're running into a compile error here, you're probably trying to compile POV-Ray
99+
// with Boost 1.65.0 or later and a non-C++11-compliant compiler. We currently do not support such a
100+
// combination.)
101+
using POV_TR1_NAMESPACE::shared_ptr;
102+
using POV_TR1_NAMESPACE::weak_ptr;
87103

88104
#endif // STD_POV_TYPES_DECLARED
89105

vfe/win/syspovconfig.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,20 @@ using std::min;
6767
#include <string>
6868
#include <vector>
6969
#include <list>
70-
#include <boost/tr1/memory.hpp>
70+
71+
#include <boost/version.hpp>
72+
#if BOOST_VERSION < 106500
73+
// Pulling in smart pointers is easy with Boost versions prior to 1.65.0, with the
74+
// `boost/tr1/*.hpp` set of headers simply pulling in whatever is available (C++11, TR1 or
75+
// boost's own implementation) and making it available in the `std::tr1` namespace.
76+
#include <boost/tr1/memory.hpp>
77+
#define POV_TR1_NAMESPACE std::tr1
78+
#else
79+
// With `boost/tr1/*.hpp` unavailable, we're currently blindly relying on the compiler to
80+
// be compliant with C++11.
81+
#include <memory>
82+
#define POV_TR1_NAMESPACE std
83+
#endif
7184

7285
// when we say 'string' we mean std::string
7386
using std::string;
@@ -83,8 +96,12 @@ using std::list;
8396
using std::runtime_error;
8497

8598
// these may actually be the boost implementations, depending on what boost/tr1/memory.hpp has pulled in
86-
using std::tr1::shared_ptr;
87-
using std::tr1::weak_ptr;
99+
// (NOTE: If you're running into a compile error here, you're probably trying to compile POV-Ray
100+
// for Windows with Boost 1.65.0 or later and a non-C++11-compliant compiler. We currently do not
101+
// support such a combination. Please use the Boost version that came bundled with the POV-Ray
102+
// source code.)
103+
using POV_TR1_NAMESPACE::shared_ptr;
104+
using POV_TR1_NAMESPACE::weak_ptr;
88105

89106
#endif // STD_POV_TYPES_DECLARED
90107

0 commit comments

Comments
 (0)