1/*
2---------------------------------------------------------------------------
3Open Asset Import Library (assimp)
4---------------------------------------------------------------------------
5
6Copyright (c) 2006-2025, assimp team
7
8All rights reserved.
9
10Redistribution and use of this software in source and binary forms,
11with or without modification, are permitted provided that the following
12conditions are met:
13
14* Redistributions of source code must retain the above
15 copyright notice, this list of conditions and the
16 following disclaimer.
17
18* Redistributions in binary form must reproduce the above
19 copyright notice, this list of conditions and the
20 following disclaimer in the documentation and/or other
21 materials provided with the distribution.
22
23* Neither the name of the assimp team, nor the names of its
24 contributors may be used to endorse or promote products
25 derived from this software without specific prior
26 written permission of the assimp team.
27
28THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39---------------------------------------------------------------------------
40*/
41
42/** @file defs.h
43 * @brief Assimp build configuration setup. See the notes in the comment
44 * blocks to find out how to customize _your_ Assimp build.
45 */
46
47#pragma once
48#ifndef AI_DEFINES_H_INC
49#define AI_DEFINES_H_INC
50
51#ifdef __GNUC__
52# pragma GCC system_header
53#endif
54
55#include <assimp/config.h>
56
57//////////////////////////////////////////////////////////////////////////
58/**
59 * @brief Define ASSIMP_BUILD_NO_XX_IMPORTER to disable a specific file format loader.
60 *
61 * The loader is be excluded from the
62 * build in this case. 'XX' stands for the most common file
63 * extension of the file format. E.g.:
64 * ASSIMP_BUILD_NO_X_IMPORTER disables the X loader.
65 *
66 * If you're unsure about that, take a look at the implementation of the
67 * import plugin you wish to disable. You'll find the right define in the
68 * first lines of the corresponding unit.
69 *
70 * Other (mixed) configuration switches are listed here:
71 * ASSIMP_BUILD_NO_COMPRESSED_X
72 * - Disable support for compressed X files (zip)
73 * ASSIMP_BUILD_NO_COMPRESSED_BLEND
74 * - Disable support for compressed Blender files (zip)
75 * ASSIMP_BUILD_NO_COMPRESSED_IFC
76 * - Disable support for IFCZIP files (unzip)
77 */
78//////////////////////////////////////////////////////////////////////////
79
80#ifndef ASSIMP_BUILD_NO_COMPRESSED_X
81# define ASSIMP_BUILD_NEED_Z_INFLATE
82#endif
83
84#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
85# define ASSIMP_BUILD_NEED_Z_INFLATE
86#endif
87
88#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
89# define ASSIMP_BUILD_NEED_Z_INFLATE
90# define ASSIMP_BUILD_NEED_UNZIP
91#endif
92
93#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
94# define ASSIMP_BUILD_NEED_Z_INFLATE
95# define ASSIMP_BUILD_NEED_UNZIP
96#endif
97
98/**
99 * @brief We need those constants, workaround for any platforms where nobody defined them yet.
100 */
101#if (!defined SIZE_MAX)
102# define SIZE_MAX (~((size_t)0))
103#endif
104
105//////////////////////////////////////////////////////////////////////////
106/** @brief Define ASSIMP_BUILD_NO_XX_PROCESS to disable a specific
107 *
108 * post processing step. This is the current list of process names ('XX'):
109 * CALCTANGENTS
110 * JOINVERTICES
111 * TRIANGULATE
112 * DROPFACENORMALS
113 * GENFACENORMALS
114 * GENVERTEXNORMALS
115 * REMOVEVC
116 * SPLITLARGEMESHES
117 * PRETRANSFORMVERTICES
118 * LIMITBONEWEIGHTS
119 * VALIDATEDS
120 * IMPROVECACHELOCALITY
121 * FIXINFACINGNORMALS
122 * REMOVE_REDUNDANTMATERIALS
123 * OPTIMIZEGRAPH
124 * SORTBYPTYPE
125 * FINDINVALIDDATA
126 * TRANSFORMTEXCOORDS
127 * GENUVCOORDS
128 * ENTITYMESHBUILDER
129 * EMBEDTEXTURES
130 * MAKELEFTHANDED
131 * FLIPUVS
132 * FLIPWINDINGORDER
133 * OPTIMIZEMESHES
134 * OPTIMIZEANIMS
135 * OPTIMIZEGRAPH
136 * GENENTITYMESHES
137 * FIXTEXTUREPATHS
138 * GENBOUNDINGBOXES
139 */
140
141//////////////////////////////////////////////////////////////////////////
142/** @brief Define 'ASSIMP_BUILD_DLL_EXPORT' to build a DLL of the library
143 *
144 * Define 'ASSIMP_DLL' before including Assimp to link to ASSIMP in
145 * an external DLL under Windows. Default is static linkage.
146 */
147//////////////////////////////////////////////////////////////////////////
148#ifdef _WIN32
149# undef ASSIMP_API
150# ifdef ASSIMP_BUILD_DLL_EXPORT
151# define ASSIMP_API __declspec(dllexport)
152# define ASSIMP_API_WINONLY __declspec(dllexport)
153# elif (defined ASSIMP_DLL)
154# define ASSIMP_API __declspec(dllimport)
155# define ASSIMP_API_WINONLY __declspec(dllimport)
156# else
157# define ASSIMP_API
158# define ASSIMP_API_WINONLY
159# endif
160#else
161# define ASSIMP_API __attribute__((visibility("default")))
162# define ASSIMP_API_WINONLY
163#endif // _WIN32
164
165/**
166 * @brief Helper macros
167 *
168 * @def AI_FORCE_INLINE
169 * @brief Force the compiler to inline a function, if possible
170 *
171 * @def AI_WONT_RETURN
172 * @brief Tells the compiler that a function never returns.
173 *
174 * Used in code analysis to skip dead paths (e.g. after an assertion evaluated to false).
175 */
176#ifdef _MSC_VER
177 #pragma warning(disable : 4521 4512 4714 4127 4510)
178 #if _MSC_VER < 1900
179 #pragma warning(disable : 4351)
180 #endif
181 #ifdef ASSIMP_BUILD_DLL_EXPORT
182 #pragma warning(disable : 4251)
183 #endif
184 #define AI_FORCE_INLINE inline
185 #define AI_WONT_RETURN __declspec(noreturn)
186#elif defined(SWIG)
187 /* Do nothing, the relevant defines are all in AssimpSwigPort.i */
188#else
189 #define AI_WONT_RETURN
190 #define AI_FORCE_INLINE inline
191#endif // (defined _MSC_VER)
192
193#ifdef __GNUC__
194# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))
195#elif _MSC_VER
196#if defined(__clang__)
197# define AI_WONT_RETURN_SUFFIX __attribute__((noreturn))
198#else
199# define AI_WONT_RETURN_SUFFIX
200#endif
201#else
202# define AI_WONT_RETURN_SUFFIX
203#endif // (defined __clang__)
204
205#ifdef __cplusplus
206/* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
207 * in doxydocs. */
208#define C_STRUCT
209#define C_ENUM
210#else
211//////////////////////////////////////////////////////////////////////////
212/* To build the documentation, make sure ASSIMP_DOXYGEN_BUILD
213 * is defined by Doxygen's preprocessor. The corresponding
214 * entries in the DOXYFILE are: */
215//////////////////////////////////////////////////////////////////////////
216#if 0
217 ENABLE_PREPROCESSING = YES
218 MACRO_EXPANSION = YES
219 EXPAND_ONLY_PREDEF = YES
220 SEARCH_INCLUDES = YES
221 INCLUDE_PATH =
222 INCLUDE_FILE_PATTERNS =
223 PREDEFINED = ASSIMP_DOXYGEN_BUILD=1
224 EXPAND_AS_DEFINED = C_STRUCT C_ENUM
225 SKIP_FUNCTION_MACROS = YES
226#endif
227//////////////////////////////////////////////////////////////////////////
228/* Doxygen gets confused if we use c-struct typedefs to avoid
229 * the explicit 'struct' notation. This trick here has the same
230 * effect as the TYPEDEF_HIDES_STRUCT option, but we don't need
231 * to typedef all structs/enums. */
232//////////////////////////////////////////////////////////////////////////
233#if (defined ASSIMP_DOXYGEN_BUILD)
234# define C_STRUCT
235# define C_ENUM
236#else
237# define C_STRUCT struct
238# define C_ENUM enum
239#endif
240#endif
241
242#if (defined(__BORLANDC__) || defined(__BCPLUSPLUS__))
243# error Currently, Borland is unsupported. Feel free to port Assimp.
244#endif
245
246//////////////////////////////////////////////////////////////////////////
247/**
248 * Define ASSIMP_BUILD_SINGLETHREADED to compile assimp
249 * without threading support. The library doesn't utilize
250 * threads then and is itself not threadsafe.
251 */
252//////////////////////////////////////////////////////////////////////////
253#ifndef ASSIMP_BUILD_SINGLETHREADED
254# define ASSIMP_BUILD_SINGLETHREADED
255#endif
256
257#if defined(_DEBUG) || !defined(NDEBUG)
258# define ASSIMP_BUILD_DEBUG
259#endif
260
261//////////////////////////////////////////////////////////////////////////
262/* Define ASSIMP_DOUBLE_PRECISION to compile assimp
263 * with double precision support (64-bit). */
264//////////////////////////////////////////////////////////////////////////
265
266#ifdef ASSIMP_DOUBLE_PRECISION
267typedef double ai_real;
268typedef signed long long int ai_int;
269typedef unsigned long long int ai_uint;
270#ifndef ASSIMP_AI_REAL_TEXT_PRECISION
271#define ASSIMP_AI_REAL_TEXT_PRECISION 17
272#endif // ASSIMP_AI_REAL_TEXT_PRECISION
273#else // ASSIMP_DOUBLE_PRECISION
274typedef float ai_real;
275typedef signed int ai_int;
276typedef unsigned int ai_uint;
277#ifndef ASSIMP_AI_REAL_TEXT_PRECISION
278#define ASSIMP_AI_REAL_TEXT_PRECISION 9
279#endif // ASSIMP_AI_REAL_TEXT_PRECISION
280#endif // ASSIMP_DOUBLE_PRECISION
281
282//////////////////////////////////////////////////////////////////////////
283/* Useful constants */
284//////////////////////////////////////////////////////////////////////////
285
286/* This is PI. Hi PI. */
287#define AI_MATH_PI (3.141592653589793238462643383279)
288#define AI_MATH_TWO_PI (AI_MATH_PI * 2.0)
289#define AI_MATH_HALF_PI (AI_MATH_PI * 0.5)
290
291/* And this is to avoid endless casts to float */
292#define AI_MATH_PI_F (3.1415926538f)
293#define AI_MATH_TWO_PI_F (AI_MATH_PI_F * 2.0f)
294#define AI_MATH_HALF_PI_F (AI_MATH_PI_F * 0.5f)
295
296/* Tiny macro to convert from radians to degrees and back */
297#define AI_DEG_TO_RAD(x) ((x) * (ai_real) 0.0174532925)
298#define AI_RAD_TO_DEG(x) ((x) * (ai_real) 57.2957795)
299
300/* Numerical limits */
301#ifdef __cplusplus
302constexpr ai_real ai_epsilon = (ai_real) 1e-6;
303#else
304# define ai_epsilon ((ai_real)1e-6)
305#endif
306
307/**
308 * @brief Support for big-endian builds
309 *
310 * This will check which byte ordering is used on the target architecture.
311 */
312#if defined(__BYTE_ORDER__)
313# if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
314# if !defined(__BIG_ENDIAN__)
315# define __BIG_ENDIAN__
316# endif
317# else /* little endian */
318# if defined(__BIG_ENDIAN__)
319# undef __BIG_ENDIAN__
320# endif
321# endif
322#endif
323#if defined(__BIG_ENDIAN__)
324# define AI_BUILD_BIG_ENDIAN
325#endif
326
327/**
328 * @brief To avoid running out of memory
329 *
330 * This can be adjusted for specific use cases
331 * It's NOT a total limit, just a limit for individual allocations
332 */
333#define AI_MAX_ALLOC(type) ((256U * 1024 * 1024) / sizeof(type))
334
335#ifndef _MSC_VER
336# if __cplusplus >= 201103L // C++11
337# define AI_NO_EXCEPT noexcept
338# else
339# define AI_NO_EXCEPT
340# endif
341#else
342# if (_MSC_VER >= 1915)
343# define AI_NO_EXCEPT noexcept
344# else
345# define AI_NO_EXCEPT
346# endif
347#endif // _MSC_VER
348
349/**
350 * @brief Helper macro to set a pointer to NULL in debug builds
351 */
352#if (defined ASSIMP_BUILD_DEBUG)
353# define AI_DEBUG_INVALIDATE_PTR(x) x = NULL;
354#else
355# define AI_DEBUG_INVALIDATE_PTR(x)
356#endif
357
358#define AI_COUNT_OF(X) (sizeof(X) / sizeof((X)[0]))
359
360/**
361 * @brief Will mark functions or classes as deprecated.
362 *
363 * Deprecation means that we will remove this function, class or methods in the next m
364 */
365#if defined(__GNUC__) || defined(__clang__)
366# define AI_DEPRECATED __attribute__((deprecated))
367#elif defined(_MSC_VER)
368# define AI_DEPRECATED __declspec(deprecated)
369#else
370# pragma message("WARNING: You need to implement DEPRECATED for this compiler")
371# define AI_DEPRECATED
372#endif
373
374#endif // !! AI_DEFINES_H_INC
375

source code of qtquick3d/src/3rdparty/assimp/src/include/assimp/defs.h