OpenVDB  2.1.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 
61 #if defined(__GNUC__) && OPENVDB_CHECK_GCC(4, 4)
62  #define OPENVDB_STATIC_SPECIALIZATION
63 #else
64  #define OPENVDB_STATIC_SPECIALIZATION static
65 #endif
66 
67 
83 #if defined(__INTEL_COMPILER)
84  // Disable ICC remarks 111 ("statement is unreachable"), 128 ("loop is not reachable"),
85  // 185 ("dynamic initialization in unreachable code"), and 280 ("selector expression
86  // is constant").
87  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN \
88  _Pragma("warning (push)") \
89  _Pragma("warning (disable:111)") \
90  _Pragma("warning (disable:128)") \
91  _Pragma("warning (disable:185)") \
92  _Pragma("warning (disable:280)")
93  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END \
94  _Pragma("warning (pop)")
95 #else
96  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
97  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
98 #endif
99 
100 
104 #ifndef _USE_MATH_DEFINES
105  #define _USE_MATH_DEFINES
106 #endif
107 
109 #ifdef _MSC_VER
110  #include <boost/math/special_functions/round.hpp>
111  using boost::math::round;
112 #endif
113 
115 #ifdef _MSC_VER
116  #include <float.h>
117  static inline double copysign(double x, double y) { return _copysign(x, y); }
118 #endif
119 
122 #include <boost/cstdint.hpp>
123 using boost::int8_t;
124 using boost::int16_t;
125 using boost::int32_t;
126 using boost::int64_t;
127 using boost::uint8_t;
128 using boost::uint16_t;
129 using boost::uint32_t;
130 using boost::uint64_t;
131 
133 #ifdef OPENVDB_EXPORT
134 #undef OPENVDB_EXPORT
135 #endif
136 #ifdef OPENVDB_IMPORT
137 #undef OPENVDB_IMPORT
138 #endif
139 #ifdef __GNUC__
140  #define OPENVDB_EXPORT __attribute__((visibility("default")))
141  #define OPENVDB_IMPORT __attribute__((visibility("default")))
142 #endif
143 #ifdef _WIN32
144  #ifdef OPENVDB_DLL
145  #define OPENVDB_EXPORT __declspec(dllexport)
146  #define OPENVDB_IMPORT __declspec(dllimport)
147  #else
148  #define OPENVDB_EXPORT
149  #define OPENVDB_IMPORT
150  #endif
151 #endif
152 
156 #ifdef OPENVDB_API
157 #undef OPENVDB_API
158 #endif
159 #ifdef OPENVDB_PRIVATE
160  #define OPENVDB_API OPENVDB_EXPORT
161 #else
162  #define OPENVDB_API OPENVDB_IMPORT
163 #endif
164 #ifdef OPENVDB_HOUDINI_API
165 #undef OPENVDB_HOUDINI_API
166 #endif
167 #ifdef OPENVDB_HOUDINI_PRIVATE
168  #define OPENVDB_HOUDINI_API OPENVDB_EXPORT
169 #else
170  #define OPENVDB_HOUDINI_API OPENVDB_IMPORT
171 #endif
172 
173 #endif // OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
174 
175 // Copyright (c) 2012-2013 DreamWorks Animation LLC
176 // All rights reserved. This software is distributed under the
177 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )