OpenVDB  1.2.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 remark #111 ("statement is unreachable") and
85  // remark #185 ("dynamic initialization in unreachable code").
86  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN \
87  _Pragma("warning (push)") \
88  _Pragma("warning (disable:111)") \
89  _Pragma("warning (disable:185)")
90  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END \
91  _Pragma("warning (pop)")
92 #else
93  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
94  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
95 #endif
96 
97 
101 #ifndef _USE_MATH_DEFINES
102  #define _USE_MATH_DEFINES
103 #endif
104 
106 #ifdef _MSC_VER
107  #include <boost/math/special_functions/round.hpp>
108  using boost::math::round;
109 #endif
110 
112 #ifdef _MSC_VER
113  #include <float.h>
114  static inline double copysign(double x, double y) { return _copysign(x, y); }
115 #endif
116 
119 #include <boost/cstdint.hpp>
120 using boost::int8_t;
121 using boost::int16_t;
122 using boost::int32_t;
123 using boost::int64_t;
124 using boost::uint8_t;
125 using boost::uint16_t;
126 using boost::uint32_t;
127 using boost::uint64_t;
128 
130 #ifdef OPENVDB_EXPORT
131 #undef OPENVDB_EXPORT
132 #endif
133 #ifdef OPENVDB_IMPORT
134 #undef OPENVDB_IMPORT
135 #endif
136 #ifdef __GNUC__
137  #define OPENVDB_EXPORT __attribute__((visibility("default")))
138  #define OPENVDB_IMPORT __attribute__((visibility("default")))
139 #endif
140 #ifdef _WIN32
141  #ifdef OPENVDB_DLL
142  #define OPENVDB_EXPORT __declspec(dllexport)
143  #define OPENVDB_IMPORT __declspec(dllimport)
144  #else
145  #define OPENVDB_EXPORT
146  #define OPENVDB_IMPORT
147  #endif
148 #endif
149 
153 #ifdef OPENVDB_API
154 #undef OPENVDB_API
155 #endif
156 #ifdef OPENVDB_PRIVATE
157  #define OPENVDB_API OPENVDB_EXPORT
158 #else
159  #define OPENVDB_API OPENVDB_IMPORT
160 #endif
161 #ifdef OPENVDB_HOUDINI_API
162 #undef OPENVDB_HOUDINI_API
163 #endif
164 #ifdef OPENVDB_HOUDINI_PRIVATE
165  #define OPENVDB_HOUDINI_API OPENVDB_EXPORT
166 #else
167  #define OPENVDB_HOUDINI_API OPENVDB_IMPORT
168 #endif
169 
170 #endif // OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
171 
172 // Copyright (c) 2012-2013 DreamWorks Animation LLC
173 // All rights reserved. This software is distributed under the
174 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )