HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Platform.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2012-2017 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 //
29 ///////////////////////////////////////////////////////////////////////////
30 ///
31 /// @file Platform.h
32 
33 #ifndef OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
34 #define OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
35 
36 #include "PlatformConfig.h"
37 
38 #define PRAGMA(x) _Pragma(#x)
39 
40 /// Use OPENVDB_DEPRECATED to mark functions as deprecated.
41 /// It should be placed right before the signature of the function,
42 /// e.g., "OPENVDB_DEPRECATED void functionName();".
43 #ifdef OPENVDB_DEPRECATED
44 #undef OPENVDB_DEPRECATED
45 #endif
46 #ifdef _MSC_VER
47  #define OPENVDB_DEPRECATED __declspec(deprecated)
48 #else
49  #define OPENVDB_DEPRECATED __attribute__ ((deprecated))
50 #endif
51 
52 /// Macro for determining if GCC version is >= than X.Y
53 #if defined(__GNUC__)
54  #define OPENVDB_CHECK_GCC(MAJOR, MINOR) \
55  (__GNUC__ > MAJOR || (__GNUC__ == MAJOR && __GNUC_MINOR__ >= MINOR))
56 #else
57  #define OPENVDB_CHECK_GCC(MAJOR, MINOR) 0
58 #endif
59 
60 /// Macro for determining if there are sufficient C++0x/C++11 features
61 #ifdef __INTEL_COMPILER
62  #ifdef __INTEL_CXX11_MODE__
63  #define OPENVDB_HAS_CXX11 1
64  #endif
65 #elif defined(__clang__)
66  #ifndef _LIBCPP_VERSION
67  #include <ciso646>
68  #endif
69  #ifdef _LIBCPP_VERSION
70  #define OPENVDB_HAS_CXX11 1
71  #endif
72 #elif defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus > 199711L)
73  #define OPENVDB_HAS_CXX11 1
74 #elif defined(_MSC_VER)
75  #if (_MSC_VER >= 1700)
76  #define OPENVDB_HAS_CXX11 1
77  #endif
78 #endif
79 #if defined(__GNUC__) && !OPENVDB_CHECK_GCC(4, 4)
80  // ICC uses GCC's standard library headers, so even if the ICC version
81  // is recent enough for C++11, the GCC version might not be.
82  #undef OPENVDB_HAS_CXX11
83 #endif
84 
85 /// For compilers that need templated function specializations to have
86 /// storage qualifiers, we need to declare the specializations as static inline.
87 /// Otherwise, we'll get linker errors about multiply defined symbols.
88 #if defined(__GNUC__) && OPENVDB_CHECK_GCC(4, 4)
89  #define OPENVDB_STATIC_SPECIALIZATION
90 #else
91  #define OPENVDB_STATIC_SPECIALIZATION static
92 #endif
93 
94 
95 /// Bracket code with OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN/_END,
96 /// as in the following example, to inhibit ICC remarks about unreachable code:
97 /// @code
98 /// template<typename NodeType>
99 /// void processNode(NodeType& node)
100 /// {
101 /// OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
102 /// if (NodeType::LEVEL == 0) return; // ignore leaf nodes
103 /// int i = 0;
104 /// ...
105 /// OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
106 /// }
107 /// @endcode
108 /// In the above, <tt>NodeType::LEVEL == 0</tt> is a compile-time constant expression,
109 /// so for some template instantiations, the line below it is unreachable.
110 #if defined(__INTEL_COMPILER)
111  // Disable ICC remarks 111 ("statement is unreachable"), 128 ("loop is not reachable"),
112  // 185 ("dynamic initialization in unreachable code"), and 280 ("selector expression
113  // is constant").
114  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN \
115  _Pragma("warning (push)") \
116  _Pragma("warning (disable:111)") \
117  _Pragma("warning (disable:128)") \
118  _Pragma("warning (disable:185)") \
119  _Pragma("warning (disable:280)")
120  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END \
121  _Pragma("warning (pop)")
122 #elif defined(__clang__)
123  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN \
124  PRAGMA(clang diagnostic push) \
125  PRAGMA(clang diagnostic ignored "-Wunreachable-code")
126  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END \
127  PRAGMA(clang diagnostic pop)
128 #else
129  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
130  #define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
131 #endif
132 
133 
134 #ifdef _MSC_VER
135  /// Visual C++ does not have constants like M_PI unless this is defined.
136  /// @note This is needed even though the core library is built with this but
137  /// hcustom 12.1 doesn't define it. So this is needed for HDK operators.
138  #ifndef _USE_MATH_DEFINES
139  #define _USE_MATH_DEFINES
140  #endif
141  /// Visual C++ does not have round
142  #include <hboost/math/special_functions/round.hpp>
143  using hboost::math::round;
144 #endif
145 
146 /// Visual C++ uses _copysign() instead of copysign()
147 #ifdef _MSC_VER
148  #include <float.h>
149  static inline double copysign(double x, double y) { return _copysign(x, y); }
150 #endif
151 
152 /// Visual C++ does not have stdint.h which defines types like uint64_t.
153 /// So for portability we instead include hboost/cstdint.hpp.
154 #include <hboost/cstdint.hpp>
155 using hboost::int8_t;
156 using hboost::int16_t;
157 using hboost::int32_t;
158 using hboost::int64_t;
159 using hboost::uint8_t;
160 using hboost::uint16_t;
161 using hboost::uint32_t;
162 using hboost::uint64_t;
163 
164 /// Helper macros for defining library symbol visibility
165 #ifdef OPENVDB_EXPORT
166 #undef OPENVDB_EXPORT
167 #endif
168 #ifdef OPENVDB_IMPORT
169 #undef OPENVDB_IMPORT
170 #endif
171 #ifdef __GNUC__
172  #define OPENVDB_EXPORT __attribute__((visibility("default")))
173  #define OPENVDB_IMPORT __attribute__((visibility("default")))
174 #endif
175 #ifdef _WIN32
176  #ifdef OPENVDB_DLL
177  #define OPENVDB_EXPORT __declspec(dllexport)
178  #define OPENVDB_IMPORT __declspec(dllimport)
179  #else
180  #define OPENVDB_EXPORT
181  #define OPENVDB_IMPORT
182  #endif
183 #endif
184 
185 /// All classes and public free standing functions must be explicitly marked
186 /// as <lib>_API to be exported. The <lib>_PRIVATE macros are defined when
187 /// building that particular library.
188 #ifdef OPENVDB_API
189 #undef OPENVDB_API
190 #endif
191 #ifdef OPENVDB_PRIVATE
192  #define OPENVDB_API OPENVDB_EXPORT
193 #else
194  #define OPENVDB_API OPENVDB_IMPORT
195 #endif
196 #ifdef OPENVDB_HOUDINI_API
197 #undef OPENVDB_HOUDINI_API
198 #endif
199 #ifdef OPENVDB_HOUDINI_PRIVATE
200  #define OPENVDB_HOUDINI_API OPENVDB_EXPORT
201 #else
202  #define OPENVDB_HOUDINI_API OPENVDB_IMPORT
203 #endif
204 
205 #endif // OPENVDB_PLATFORM_HAS_BEEN_INCLUDED
206 
207 // Copyright (c) 2012-2017 DreamWorks Animation LLC
208 // All rights reserved. This software is distributed under the
209 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
GLint y
Definition: glcorearb.h:102
GLint GLenum GLint x
Definition: glcorearb.h:408