HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
version.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: Apache-2.0
3 
4 /// @file openvdb/version.h
5 /// @brief Library and file format version numbers
6 ///
7 /// @details
8 /// When the library is built with the latest ABI, its namespace has the form
9 /// <B>openvdb::vX_Y</B>, where @e X and @e Y are the major and minor version
10 /// numbers.
11 ///
12 /// The library can be built using an older ABI by changing the value of the
13 /// @b OPENVDB_ABI_VERSION_NUMBER. (e.g., via <TT>-DOPENVDB_ABI_VERSION_NUMBER=<I>N</I></TT>).
14 /// In that case, the namespace has the form <B>openvdb::vX_YabiN</B>,
15 /// where N is the ABI version number.
16 ///
17 /// The ABI version must be set consistently when building code that depends on
18 /// OpenVDB.
19 ///
20 /// The ABI version number defaults to the library major version number, which
21 /// gets incremented whenever changes are made to the ABI of the Grid class or
22 /// related classes (Tree, Transform, Metadata, etc.). Setting the ABI version
23 /// number to an earlier library version number disables grid ABI changes made
24 /// since that library version.
25 ///
26 /// The library minor version number gets incremented whenever a change is made
27 /// to any aspect of the public API (not just the grid API) that necessitates
28 /// changes to client code. Changes to APIs in private or internal namespaces
29 /// do not trigger a minor version number increment; such APIs should not be
30 /// used in client code.
31 ///
32 /// A patch version number increment indicates a change&mdash;usually a new
33 /// feature or a bug fix&mdash;that does not necessitate changes to client code
34 /// but rather only recompilation of that code (because the library namespace
35 /// incorporates the version number).
36 ///
37 /// The file format version number gets incremented when it becomes possible to
38 /// write files that cannot safely be read with older versions of the library.
39 /// Not all files written in a newer format are incompatible with older
40 /// libraries, however. And in general, files containing grids of unknown type
41 /// can be read safely, although the unknown grids will not be accessible.
42 
43 #ifndef OPENVDB_VERSION_HAS_BEEN_INCLUDED
44 #define OPENVDB_VERSION_HAS_BEEN_INCLUDED
45 
46 #include "openvdb/Platform.h"
47 
48 #include <cstddef> // size_t
49 #include <cstdint> // uint32_t
50 
51 ///////////////////////////////////////////////////////////////////////////////
52 ///////////////////////////////////////////////////////////////////////////////
53 
54 // Auto generated build configurations from CMake
55 
56 ///@{
57 /// @brief Library major, minor and patch version numbers
58 /// @hideinitializer
59 #define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 13
60 /// @hideinitializer
61 #define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER 0
62 /// @hideinitializer
63 #define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 0
64 ///@}
65 
66 /// @note This ifndef exists for compatibility with older versions of OpenVDB.
67 /// This value should never be different from the value configured when
68 /// OpenVDB was built, but this previously needed to be defined by downstream
69 /// software. Redefining it here would cause build failures, so this allows
70 /// users to transition and remove the define in their build systems.
71 #ifndef OPENVDB_ABI_VERSION_NUMBER
72 /// @brief The ABI version that OpenVDB was built with
73 /// @hideinitializer
74 #define OPENVDB_ABI_VERSION_NUMBER 13
75 #endif
76 
77 /// @brief Library version number string of the form "<major>.<minor>.<patch>"
78 /// @details This is a macro rather than a static constant because we typically
79 /// want the compile-time version number, not the runtime version number
80 /// (although the two are usually the same).
81 /// @hideinitializer
82 #define OPENVDB_LIBRARY_VERSION_STRING "13.0.0"
83 
84 /// @brief Library version number string of the form "<major>.<minor>.<patch>abi<abi>"
85 /// @details This is a macro rather than a static constant because we typically
86 /// want the compile-time version number, not the runtime version number
87 /// (although the two are usually the same).
88 /// @hideinitializer
89 #define OPENVDB_LIBRARY_ABI_VERSION_STRING "13.0.0abi13"
90 
91 /// @brief Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
92 /// @hideinitializer
93 #define OPENVDB_LIBRARY_VERSION_NUMBER 218103808
94 
95 /// @brief Where this version was compiled from if it comes from a
96 /// git repo.
97 #define OPENVDB_PACKAGE_URL "https://github.com/sideeffects/openvdb_dev.git"
98 #define OPENVDB_PACKAGE_REVISION "ca51e1fb0a7ac9c22d163d743690e285499a23ec"
99 
100 /// @brief The version namespace name for this library version
101 /// @hideinitializer
102 ///
103 /// When the ABI version number matches the library major version number,
104 /// symbols are named as in the following examples:
105 /// - @b openvdb::vX_Y::Vec3i
106 /// - @b openvdb::vX_Y::io::File
107 /// - @b openvdb::vX_Y::tree::Tree
108 ///
109 /// where X and Y are the major and minor version numbers.
110 ///
111 /// When the ABI version number does not match the library major version number,
112 /// symbol names include the ABI version:
113 /// - @b openvdb::vX_YabiN::Vec3i
114 /// - @b openvdb::vX_YabiN::io::File
115 /// - @b openvdb::vX_YabiN::tree::Tree
116 ///
117 /// where X, Y and N are the major, minor and ABI version numbers, respectively.
118 #if OPENVDB_ABI_VERSION_NUMBER == OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
119  #define OPENVDB_VERSION_NAME v13_0_sesi
120 #else
121  #define OPENVDB_VERSION_NAME v13_0_sesi_abi13
122 #endif
123 
124 /* Denotes whether VDB was built with IMath Half support */
125 #ifndef OPENVDB_USE_IMATH_HALF
126 /* #undef OPENVDB_USE_IMATH_HALF */
127 /* Denotes whether VDB was built against Imath 3+ */
128 /* #undef OPENVDB_IMATH_VERSION */
129 #endif
130 
131 /* Denotes whether VDB was built with Blosc support */
132 #ifndef OPENVDB_USE_BLOSC
133 #define OPENVDB_USE_BLOSC
134 #endif
135 
136 /* Denotes whether VDB was built with ZLIB support */
137 #ifndef OPENVDB_USE_ZLIB
138 #define OPENVDB_USE_ZLIB
139 #endif
140 
141 /* Denotes whether VDB was built with Delayed Loading support */
142 #ifndef OPENVDB_USE_DELAYED_LOADING
143 #define OPENVDB_USE_DELAYED_LOADING
144 #endif
145 
146 /* Denotes whether VDB was built asserts enabled in VDB code */
147 #ifndef OPENVDB_ENABLE_ASSERTS
148 /* #undef OPENVDB_ENABLE_ASSERTS */
149 #endif
150 
151 /* Denotes whether VDB was built with explicit template instantiation */
152 #ifndef OPENVDB_USE_EXPLICIT_INSTANTIATION
153 #define OPENVDB_USE_EXPLICIT_INSTANTIATION
154 #endif
155 
156 /* Defines the macros for explicit template declarations. */
157 #define OPENVDB_INSTANTIATE extern template OPENVDB_TEMPLATE_IMPORT
158 #define OPENVDB_INSTANTIATE_CLASS extern template class OPENVDB_TEMPLATE_IMPORT
159 #define OPENVDB_INSTANTIATE_STRUCT extern template struct OPENVDB_TEMPLATE_IMPORT
160 
161 /* Defines the macros for explicit template instantiations. */
162 #define OPENVDB_REAL_TREE_INSTANTIATE(Function) \
163  OPENVDB_INSTANTIATE Function(FloatTree); \
164  OPENVDB_INSTANTIATE Function(DoubleTree);
165 #define OPENVDB_NUMERIC_TREE_INSTANTIATE(Function) \
166  OPENVDB_INSTANTIATE Function(Int32Tree); \
167  OPENVDB_INSTANTIATE Function(Int64Tree); \
168  OPENVDB_INSTANTIATE Function(FloatTree); \
169  OPENVDB_INSTANTIATE Function(DoubleTree);
170 #define OPENVDB_VEC3_TREE_INSTANTIATE(Function) \
171  OPENVDB_INSTANTIATE Function(Vec3STree); \
172  OPENVDB_INSTANTIATE Function(Vec3DTree); \
173  OPENVDB_INSTANTIATE Function(Vec3ITree);
174 #define OPENVDB_VOLUME_TREE_INSTANTIATE(Function) \
175  OPENVDB_INSTANTIATE Function(BoolTree); \
176  OPENVDB_INSTANTIATE Function(Int32Tree); \
177  OPENVDB_INSTANTIATE Function(Int64Tree); \
178  OPENVDB_INSTANTIATE Function(FloatTree); \
179  OPENVDB_INSTANTIATE Function(DoubleTree); \
180  OPENVDB_INSTANTIATE Function(Vec3STree); \
181  OPENVDB_INSTANTIATE Function(Vec3DTree); \
182  OPENVDB_INSTANTIATE Function(Vec3ITree);
183 #define OPENVDB_ALL_TREE_INSTANTIATE(Function) \
184  OPENVDB_INSTANTIATE Function(MaskTree); \
185  OPENVDB_INSTANTIATE Function(HalfTree); \
186  OPENVDB_INSTANTIATE Function(points::PointDataTree); \
187  OPENVDB_INSTANTIATE Function(BoolTree); \
188  OPENVDB_INSTANTIATE Function(Int32Tree); \
189  OPENVDB_INSTANTIATE Function(Int64Tree); \
190  OPENVDB_INSTANTIATE Function(FloatTree); \
191  OPENVDB_INSTANTIATE Function(DoubleTree); \
192  OPENVDB_INSTANTIATE Function(Vec3STree); \
193  OPENVDB_INSTANTIATE Function(Vec3DTree); \
194  OPENVDB_INSTANTIATE Function(Vec3ITree);
195 
196 
197 ///////////////////////////////////////////////////////////////////////////////
198 ///////////////////////////////////////////////////////////////////////////////
199 
200 
201 #if OPENVDB_ABI_VERSION_NUMBER > OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
202  // If using a future OPENVDB_ABI_VERSION_NUMBER, issue a message directive.
203  // This can be suppressed by defining OPENVDB_USE_FUTURE_ABI_<VERSION>=ON.
204  // Note that, whilst the VDB CMake does not allow this option to be hit,
205  // it exists to propagate this message to downstream targets
206  #if OPENVDB_ABI_VERSION_NUMBER == 14
207  #ifndef OPENVDB_USE_FUTURE_ABI_14
208  PRAGMA(message("NOTE: ABI = 14 is still in active development and has not been finalized, "
209  "define OPENVDB_USE_FUTURE_ABI_14 to suppress this message"))
210  #endif
211  #else
212  #error expected OPENVDB_ABI_VERSION_NUMBER <= OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
213  #endif
214 #endif
215 
216 // If using an OPENVDB_ABI_VERSION_NUMBER that has been deprecated, issue a message
217 // directive. This can be suppressed by defining OPENVDB_USE_DEPRECATED_ABI_<VERSION>.
218 // Note that, whilst the VDB CMake does not allow this option to be hit,
219 // it exists to propagate this message to downstream targets
220 #ifndef OPENVDB_USE_DEPRECATED_ABI_11
221  #if OPENVDB_ABI_VERSION_NUMBER == 11
222  PRAGMA(message("NOTE: ABI = 11 is deprecated, define OPENVDB_USE_DEPRECATED_ABI_11 "
223  "to suppress this message"))
224  #endif
225 #endif
226 #ifndef OPENVDB_USE_DEPRECATED_ABI_12
227  #if OPENVDB_ABI_VERSION_NUMBER == 12
228  PRAGMA(message("NOTE: ABI = 12 is deprecated, define OPENVDB_USE_DEPRECATED_ABI_12 "
229  "to suppress this message"))
230  #endif
231 #endif
232 
233 /// By default, the @b OPENVDB_REQUIRE_VERSION_NAME macro is undefined, and
234 /// symbols from the version namespace are promoted to the top-level namespace
235 /// so that, for example, @b openvdb::v5_0::io::File can be referred to
236 /// simply as @b openvdb::io::File.
237 ///
238 /// When @b OPENVDB_REQUIRE_VERSION_NAME is defined, symbols must be
239 /// fully namespace-qualified.
240 /// @hideinitializer
241 #ifdef OPENVDB_REQUIRE_VERSION_NAME
242 #define OPENVDB_USE_VERSION_NAMESPACE
243 #else
244 // The empty namespace clause below ensures that OPENVDB_VERSION_NAME
245 // is recognized as a namespace name.
246 #define OPENVDB_USE_VERSION_NAMESPACE \
247  namespace OPENVDB_VERSION_NAME {} \
248  using namespace OPENVDB_VERSION_NAME;
249 #endif
250 
251 
252 namespace openvdb {
254 namespace OPENVDB_VERSION_NAME {
255 
256 /// @brief The magic number is stored in the first four bytes of every VDB file.
257 /// @details This can be used to quickly test whether we have a valid file or not.
258 const int32_t OPENVDB_MAGIC = 0x56444220;
259 
260 /// Library major, minor and patch version numbers
261 /// @hideinitializer
262 const uint32_t
266 /// Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
267 /// @hideinitializer
269 /// ABI version number
270 /// @hideinitializer
272 
273 /// @brief The current version number of the VDB file format
274 /// @details This can be used to enable various backwards compatibility switches
275 /// or to reject files that cannot be read.
276 const uint32_t OPENVDB_FILE_VERSION = 225;
277 
278 /// Notable file format version numbers
279 enum {
295 };
296 
297 
298 /// Return a library version number string of the form "<major>.<minor>.<patch>".
299 inline constexpr const char* getLibraryVersionString() { return OPENVDB_LIBRARY_VERSION_STRING; }
300 /// Return a library version number string of the form "<major>.<minor>.<patch>abi<abi>".
301 inline constexpr const char* getLibraryAbiVersionString() {
303 }
304 inline constexpr const char* getPackageUrl() { return OPENVDB_PACKAGE_URL; }
305 inline constexpr const char* getPackageRevision() { return OPENVDB_PACKAGE_REVISION; }
306 
307 
308 struct VersionId {
309  uint32_t first, second;
310  VersionId(): first(0), second(0) {}
311  VersionId(uint32_t major, uint32_t minor): first(major), second(minor) {}
312 };
313 
314 } // namespace OPENVDB_VERSION_NAME
315 } // namespace openvdb
316 
317 #endif // OPENVDB_VERSION_HAS_BEEN_INCLUDED
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER
Library major, minor and patch version numbers.
Definition: version.h:61
GLint first
Definition: glcorearb.h:405
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2543
constexpr const char * getLibraryAbiVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:301
const int32_t OPENVDB_MAGIC
The magic number is stored in the first four bytes of every VDB file.
Definition: version.h:258
#define PRAGMA(x)
Definition: Platform.h:9
const uint32_t OPENVDB_LIBRARY_PATCH_VERSION
Definition: version.h:265
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER
Library major, minor and patch version numbers.
Definition: version.h:63
#define OPENVDB_LIBRARY_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:82
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:246
constexpr const char * getPackageRevision()
Definition: version.h:305
#define OPENVDB_PACKAGE_URL
Where this version was compiled from if it comes from a git repo.
Definition: version.h:97
#define OPENVDB_ABI_VERSION_NUMBER
The ABI version that OpenVDB was built with.
Definition: version.h:74
#define OPENVDB_LIBRARY_VERSION_NUMBER
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:93
const uint32_t OPENVDB_LIBRARY_VERSION
Definition: version.h:268
constexpr const char * getPackageUrl()
Definition: version.h:304
VersionId(uint32_t major, uint32_t minor)
Definition: version.h:311
const uint32_t OPENVDB_LIBRARY_MAJOR_VERSION
Definition: version.h:263
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
Library major, minor and patch version numbers.
Definition: version.h:59
#define OPENVDB_PACKAGE_REVISION
Definition: version.h:98
#define OPENVDB_LIBRARY_ABI_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:89
const uint32_t OPENVDB_LIBRARY_MINOR_VERSION
Definition: version.h:264
const uint32_t OPENVDB_ABI_VERSION
Definition: version.h:271
constexpr const char * getLibraryVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:299
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:119
const uint32_t OPENVDB_FILE_VERSION
The current version number of the VDB file format.
Definition: version.h:276