OpenVDB  2.3.0
Platform.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2013 DreamWorks Animation LLC
4 //
5 // All rights reserved. This software is distributed under the
6 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7 //
8 // Redistributions of source code must retain the above copyright
9 // and license notice and the following restrictions and disclaimer.
10 //
11 // * Neither the name of DreamWorks Animation nor the names of
12 // its contributors may be used to endorse or promote products derived
13 // from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27 // LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28 //
32 
33 #ifndef OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
34 #define OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
35 
36 #include "PlatformConfig.h"
37 
41 #ifdef OPENVDB_DEPRECATED
42 #undef OPENVDB_DEPRECATED
43 #endif
44 #ifdef _MSC_VER
45  #define OPENVDB_DEPRECATED __declspec(deprecated)
46 #else
47  #define OPENVDB_DEPRECATED __attribute__ ((deprecated))
48 #endif
49 
51 #if defined(__GNUC__)
52  #define OPENVDB_CHECK_GCC(MAJOR, MINOR) \
53  (__GNUC__ > MAJOR || (__GNUC__ == MAJOR && __GNUC_MINOR__ >= MINOR))
54 #else
55  #define OPENVDB_CHECK_GCC(MAJOR, MINOR) 0
56 #endif
57 
59 #ifdef __INTEL_COMPILER
60  #ifdef __INTEL_CXX11_MODE__
61  #define OPENVDB_HAS_CXX11 1
62  #endif
63 #elif defined(__clang__)
64  #ifndef _LIBCPP_VERSION
65  #include <ciso646>
66  #endif
67  #ifdef _LIBCPP_VERSION
68  #define OPENVDB_HAS_CXX11 1
69  #endif
70 #elif defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus > 199711L)
71  #define OPENVDB_HAS_CXX11 1
72 #elif defined(_MSC_VER)
73  #if (_MSC_VER >= 1700)
74  #define OPENVDB_HAS_CXX11 1
75  #endif
76 #endif
77 #if defined(__GNUC__) && !OPENVDB_CHECK_GCC(4, 4)
78  // ICC uses GCC's standard library headers, so even if the ICC version
79  // is recent enough for C++11, the GCC version might not be.
80  #undef OPENVDB_HAS_CXX11
81 #endif
82 
86 #if defined(__GNUC__) && OPENVDB_CHECK_GCC(4, 4)
87  #define OPENVDB_STATIC_SPECIALIZATION
88 #else
89  #define OPENVDB_STATIC_SPECIALIZATION static
90 #endif
91 
92 
108 #if defined(__INTEL_COMPILER)
109  // Disable ICC remarks 111 ("statement is unreachable"), 128 ("loop is not reachable"),
110  // 185 ("dynamic initialization in unreachable code"), and 280 ("selector expression
111  // is constant").
112  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN \
113  _Pragma("warning (push)") \
114  _Pragma("warning (disable:111)") \
115  _Pragma("warning (disable:128)") \
116  _Pragma("warning (disable:185)") \
117  _Pragma("warning (disable:280)")
118  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END \
119  _Pragma("warning (pop)")
120 #else
121  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
122  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
123 #endif
124 
125 
129 #ifndef _USE_MATH_DEFINES
130  #define _USE_MATH_DEFINES
131 #endif
132 
134 #ifdef _MSC_VER
135  #include <boost/math/special_functions/round.hpp>
136  using boost::math::round;
137 #endif
138 
140 #ifdef _MSC_VER
141  #include <float.h>
142  static inline double copysign(double x, double y) { return _copysign(x, y); }
143 #endif
144 
147 #include <boost/cstdint.hpp>
148 using boost::int8_t;
149 using boost::int16_t;
150 using boost::int32_t;
151 using boost::int64_t;
152 using boost::uint8_t;
153 using boost::uint16_t;
154 using boost::uint32_t;
155 using boost::uint64_t;
156 
158 #ifdef OPENVDB_EXPORT
159 #undef OPENVDB_EXPORT
160 #endif
161 #ifdef OPENVDB_IMPORT
162 #undef OPENVDB_IMPORT
163 #endif
164 #ifdef __GNUC__
165  #define OPENVDB_EXPORT __attribute__((visibility("default")))
166  #define OPENVDB_IMPORT __attribute__((visibility("default")))
167 #endif
168 #ifdef _WIN32
169  #ifdef OPENVDB_DLL
170  #define OPENVDB_EXPORT __declspec(dllexport)
171  #define OPENVDB_IMPORT __declspec(dllimport)
172  #else
173  #define OPENVDB_EXPORT
174  #define OPENVDB_IMPORT
175  #endif
176 #endif
177 
181 #ifdef OPENVDB_API
182 #undef OPENVDB_API
183 #endif
184 #ifdef OPENVDB_PRIVATE
185  #define OPENVDB_API OPENVDB_EXPORT
186 #else
187  #define OPENVDB_API OPENVDB_IMPORT
188 #endif
189 #ifdef OPENVDB_HOUDINI_API
190 #undef OPENVDB_HOUDINI_API
191 #endif
192 #ifdef OPENVDB_HOUDINI_PRIVATE
193  #define OPENVDB_HOUDINI_API OPENVDB_EXPORT
194 #else
195  #define OPENVDB_HOUDINI_API OPENVDB_IMPORT
196 #endif
197 
198 #endif // OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
199 
200 // Copyright (c) 2012-2013 DreamWorks Animation LLC
201 // All rights reserved. This software is distributed under the
202 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )