29#ifndef PX_PREPROCESSOR_H
30#define PX_PREPROCESSOR_H
38#ifndef PX_ENABLE_FEATURES_UNDER_CONSTRUCTION
39#define PX_ENABLE_FEATURES_UNDER_CONSTRUCTION 0
42#define PX_STRINGIZE_HELPER(X) #X
43#define PX_STRINGIZE(X) PX_STRINGIZE_HELPER(X)
45#define PX_CONCAT_HELPER(X, Y) X##Y
46#define PX_CONCAT(X, Y) PX_CONCAT_HELPER(X, Y)
72 #error "Unknown VC version"
74#elif defined(__clang__)
76 #if defined (__clang_major__)
77 #define PX_CLANG_MAJOR __clang_major__
78 #elif defined (_clang_major)
79 #define PX_CLANG_MAJOR _clang_major
81 #define PX_CLANG_MAJOR 0
83#elif defined(__GNUC__)
86 #error "Unknown compiler"
96#elif defined(__linux__) || defined (__EMSCRIPTEN__)
98#elif defined(__APPLE__)
103 #error "Unknown operating system"
109#if defined(__x86_64__) || defined(_M_X64)
111#elif defined(__i386__) || defined(_M_IX86) || defined (__EMSCRIPTEN__)
113#elif defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
115#elif defined(__arm__) || defined(_M_ARM)
117#elif defined(__ppc__) || defined(_M_PPC) || defined(__CELLOS_LV2__)
120 #error "Unknown architecture"
123#if defined __EMSCRIPTEN__
132#if !defined(PX_SIMD_DISABLED)
133 #if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || (defined (__EMSCRIPTEN__) && defined(__SSE2__))
136 #if defined(_M_ARM) || defined(__ARM_NEON__) || defined(__ARM_NEON)
139 #if defined(_M_PPC) || defined(__CELLOS_LV2__)
196#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
215 #define PX_DEBUG_CRT 0
228#define PX_GCC_FAMILY (PX_CLANG || PX_GCC)
230#define PX_WINDOWS_FAMILY (PX_WIN32 || PX_WIN64)
231#define PX_LINUX_FAMILY PX_LINUX
232#define PX_APPLE_FAMILY PX_OSX
233#define PX_UNIX_FAMILY (PX_LINUX_FAMILY || PX_APPLE_FAMILY)
234#if defined(__EMSCRIPTEN__)
235 #define PX_EMSCRIPTEN 1
237 #define PX_EMSCRIPTEN 0
240#define PX_INTEL_FAMILY (PX_X64 || PX_X86)
241#define PX_ARM_FAMILY (PX_ARM || PX_A64)
242#define PX_P64_FAMILY (PX_X64 || PX_A64)
247#if defined(_LIBCPP_VERSION) || PX_WIN64 || PX_WIN32 || PX_EMSCRIPTEN
254#define PX_WINDOWS (PX_WINDOWS_FAMILY && !PX_ARM_FAMILY)
259#ifndef PX_ENABLE_ASSERTS
260 #if PX_DEBUG && !defined(__CUDACC__)
261 #define PX_ENABLE_ASSERTS 1
263 #define PX_ENABLE_ASSERTS 0
271 #if PX_WINDOWS_FAMILY || PX_LINUX
272 #define PX_C_EXPORT extern "C"
278#if PX_UNIX_FAMILY&& __GNUC__ >= 4
279 #define PX_UNIX_EXPORT __attribute__((visibility("default")))
281 #define PX_UNIX_EXPORT
285 #define PX_DLL_EXPORT __declspec(dllexport)
286 #define PX_DLL_IMPORT __declspec(dllimport)
288 #define PX_DLL_EXPORT PX_UNIX_EXPORT
289 #define PX_DLL_IMPORT
296 #if PX_WINDOWS_FAMILY
297 #define PX_CALL_CONV __cdecl
307 #define PX_PUSH_PACK_DEFAULT __pragma(pack(push, 8))
308 #define PX_POP_PACK __pragma(pack(pop))
310 #define PX_PUSH_PACK_DEFAULT _Pragma("pack(push, 8)")
311 #define PX_POP_PACK _Pragma("pack(pop)")
313 #define PX_PUSH_PACK_DEFAULT
320#define PX_INLINE inline
322 #pragma inline_depth(255)
329 #define PX_FORCE_INLINE __forceinline
331 #define PX_FORCE_INLINE inline
333 #define PX_FORCE_INLINE inline __attribute__((always_inline))
335 #define PX_FORCE_INLINE inline
342 #define PX_NOINLINE __declspec(noinline)
344 #define PX_NOINLINE __attribute__((noinline))
352#if defined(__CUDACC__)
353 #define PX_RESTRICT __restrict__
355 #define PX_RESTRICT __restrict
362 #define PX_NOALIAS __declspec(noalias)
371 #define PX_OVERRIDE override
389 #if PX_WINDOWS_FAMILY
390 #define PX_ALIGN(alignment, decl) __declspec(align(alignment)) decl
391 #define PX_ALIGN_PREFIX(alignment) __declspec(align(alignment))
392 #define PX_ALIGN_SUFFIX(alignment)
394 #define PX_ALIGN(alignment, decl) decl __attribute__((aligned(alignment)))
395 #define PX_ALIGN_PREFIX(alignment)
396 #define PX_ALIGN_SUFFIX(alignment) __attribute__((aligned(alignment)))
397 #elif defined __CUDACC__
398 #define PX_ALIGN(alignment, decl) __align__(alignment) decl
399 #define PX_ALIGN_PREFIX(alignment)
400 #define PX_ALIGN_SUFFIX(alignment) __align__(alignment))
402 #define PX_ALIGN(alignment, decl)
403 #define PX_ALIGN_PREFIX(alignment)
404 #define PX_ALIGN_SUFFIX(alignment)
425#if(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))) || (PX_APPLE_FAMILY) || (PX_SWITCH) || (PX_CLANG && PX_ARM) || (PX_CLANG && PX_A64)
426 #define PX_COMPILE_TIME_ASSERT(exp) typedef char PX_CONCAT(PxCompileTimeAssert_Dummy, __COUNTER__)[(exp) ? 1 : -1] __attribute__((unused))
428 #define PX_COMPILE_TIME_ASSERT(exp) typedef char PxCompileTimeAssert_Dummy[(exp) ? 1 : -1]
432 #define PX_OFFSET_OF(X, Y) __builtin_offsetof(X, Y)
434 #define PX_OFFSET_OF(X, Y) offsetof(X, Y)
437#define PX_OFFSETOF_BASE 0x100
438#define PX_OFFSET_OF_RT(Class, Member) (reinterpret_cast<size_t>(&reinterpret_cast<Class*>(PX_OFFSETOF_BASE)->Member) - size_t(PX_OFFSETOF_BASE))
441#if !defined(NDEBUG) ^ defined(_DEBUG)
442 #error Exactly one of NDEBUG and _DEBUG needs to be defined!
446#if !PX_CHECKED && PX_DEBUG
447 #error PX_CHECKED must be defined when PX_DEBUG is defined
451 #define PX_CUDA_CALLABLE __host__ __device__
453 #define PX_CUDA_CALLABLE
459PX_CUDA_CALLABLE
PX_INLINE void PX_UNUSED(T
const&)
468#if PX_APPLE_FAMILY || (PX_CLANG && !PX_ARM)
474#elif PX_CLANG && PX_ARM
488#if !PX_APPLE_FAMILY && !PX_EMSCRIPTEN && !(PX_CLANG && PX_X86)
494 #define PX_DUMMY_SYMBOL \
497 char PxDummySymbol; \
500 #define PX_DUMMY_SYMBOL
504 #define PX_WEAK_SYMBOL __attribute__((weak))
506 #define PX_WEAK_SYMBOL
511#define PX_NOCOPY(Class) \
513 Class(const Class&); \
514 Class& operator=(const Class&);
517#ifndef DISABLE_CUDA_PHYSX
519 #define PX_SUPPORT_GPU_PHYSX ((PX_X64 && (PX_WINDOWS_FAMILY || PX_LINUX)) || (PX_A64 && PX_LINUX))
521 #define PX_SUPPORT_GPU_PHYSX 0
524#ifndef PX_SUPPORT_EXTERN_TEMPLATE
525 #define PX_SUPPORT_EXTERN_TEMPLATE (PX_VC != 11)
527 #define PX_SUPPORT_EXTERN_TEMPLATE 0
530#define PX_FL __FILE__, __LINE__
#define PX_COMPILE_TIME_ASSERT(exp)
Definition PxPreprocessor.h:428
#define PX_INLINE
Definition PxPreprocessor.h:320
Definition PxPreprocessor.h:482