OpenNI 1.5.7
XnPlatform.h
Go to the documentation of this file.
1/*****************************************************************************
2* *
3* OpenNI 1.x Alpha *
4* Copyright (C) 2012 PrimeSense Ltd. *
5* *
6* This file is part of OpenNI. *
7* *
8* Licensed under the Apache License, Version 2.0 (the "License"); *
9* you may not use this file except in compliance with the License. *
10* You may obtain a copy of the License at *
11* *
12* http://www.apache.org/licenses/LICENSE-2.0 *
13* *
14* Unless required by applicable law or agreed to in writing, software *
15* distributed under the License is distributed on an "AS IS" BASIS, *
16* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17* See the License for the specific language governing permissions and *
18* limitations under the License. *
19* *
20*****************************************************************************/
21#ifndef __XN_PLATFORM_H__
22#define __XN_PLATFORM_H__
23
24//---------------------------------------------------------------------------
25// Platform Defines
26//---------------------------------------------------------------------------
27#define XN_PLATFORM_WIN32 1
28#define XN_PLATFORM_XBOX360 2
29#define XN_PLATFORM_PS3 3
30#define XN_PLATFORM_WII 4
31#define XN_PLATFORM_LINUX_X86 5
32#define XN_PLATFORM_FILES_ONLY 6
33#define XN_PLATFORM_ARC 6
34#define XN_PLATFORM_LINUX_ARM 7
35#define XN_PLATFORM_MACOSX 8
36#define XN_PLATFORM_ANDROID_ARM 9
37
38#define XN_PLATFORM_IS_LITTLE_ENDIAN 1
39#define XN_PLATFORM_IS_BIG_ENDIAN 2
40
41#define XN_PLATFORM_USE_NO_VAARGS 1
42#define XN_PLATFORM_USE_WIN32_VAARGS_STYLE 2
43#define XN_PLATFORM_USE_GCC_VAARGS_STYLE 3
44#define XN_PLATFORM_USE_ARC_VAARGS_STYLE 4
45
46
47// Debug: Output current macros
48#pragma message("=== OpenNI Platform Detection ===")
49#if defined(__linux__)
50 #pragma message("__linux__ is defined")
51#elif defined(linux)
52 #pragma message("linux is defined")
53#else
54 #pragma message("Neither __linux__ nor linux is defined")
55#endif
56
57#if defined(__i386__)
58 #pragma message("__i386__ is defined")
59#endif
60
61#if defined(__x86_64__)
62 #pragma message("__x86_64__ is defined")
63#endif
64
65#if defined(__arm__)
66 #pragma message("__arm__ is defined")
67#endif
68
69#if defined(__aarch64__)
70 #pragma message("__aarch64__ is defined")
71#endif
72
73#if defined(__riscv)
74 #pragma message("__riscv is defined")
75#endif
76
77#if defined(__riscv_xlen)
78 #pragma message("__riscv_xlen is defined")
79#endif
80
81#pragma message("================================")
82
83
84
85//---------------------------------------------------------------------------
86// Platform Identifier
87//---------------------------------------------------------------------------
88
89#if defined(_WIN32) // Microsoft Visual Studio
90 #ifndef RC_INVOKED
91 #if _MSC_VER < 1300 // Before MSVC7 (2003)
92 #error Xiron Platform Abstraction Layer - Win32 - Microsoft Visual Studio versions below 2003 (7.0) are not supported!
93 #endif
94
95 #if _MSC_VER > 1600 // After MSVC8 (2010)
96 #error Xiron Platform Abstraction Layer - Win32 - Microsoft Visual Studio versions above 2010 (10.0) are not supported!
97 #endif
98 #endif
99
100 #include "Win32/XnPlatformWin32.h"
101#elif defined(ANDROID) && defined(__arm__)
102 #include "Android-Arm/XnPlatformAndroid-Arm.h"
103#elif (__linux__ && (__i386__ || __x86_64__))
104 #include "Linux-x86/XnPlatformLinux-x86.h"
105#elif (__linux__ && (__arm__ || __aarch64__))
106 #include "Linux-Arm/XnPlatformLinux-Arm.h"
107#elif (__linux__ && (defined(__riscv) || defined(__riscv_xlen)))
108 #include "Linux-Arm/XnPlatformLinux-Arm.h"
109#elif _ARC
110 #include "ARC/XnPlatformARC.h"
111#elif (__APPLE__)
112 #include "MacOSX/XnPlatformMacOSX.h"
113#else
114 #if defined __INTEL_COMPILER
115 #include "Linux/XnPlatformLinux.h"
116 #else
117 #error OpenNI Platform Abstraction Layer - Unsupported Platform!
118 #endif
119#endif
120
121
122//---------------------------------------------------------------------------
123// Basic Common Macros
124//---------------------------------------------------------------------------
125#ifndef TRUE
126 #define TRUE 1
127#endif
128
129#ifndef FALSE
130 #define FALSE 0
131#endif
132
133#define XN_MIN(a,b) (((a) < (b)) ? (a) : (b))
134
135#define XN_MAX(a,b) (((a) > (b)) ? (a) : (b))
136
137typedef void (*XnFuncPtr)();
138
139#define XN_COMPILER_ASSERT(x) typedef int compileAssert[x ? 1 : -1]
140
141struct XnRegistrationHandleImpl;
142typedef struct XnRegistrationHandleImpl* XnRegistrationHandle;
143
144//---------------------------------------------------------------------------
145// API Export/Import Macros
146//---------------------------------------------------------------------------
147
148#ifdef __cplusplus
149 #define XN_C_API_EXPORT extern "C" XN_API_EXPORT
150 #define XN_C_API_IMPORT extern "C" XN_API_IMPORT
151 #define XN_CPP_API_EXPORT XN_API_EXPORT
152 #define XN_CPP_API_IMPORT XN_API_IMPORT
153#else
154 #define XN_C_API_EXPORT XN_API_EXPORT
155 #define XN_C_API_IMPORT XN_API_IMPORT
156#endif
157
158#ifdef XN_EXPORTS
159 #define XN_C_API XN_C_API_EXPORT
160 #define XN_CPP_API XN_CPP_API_EXPORT
161#else
162 #define XN_C_API XN_C_API_IMPORT
163 #define XN_CPP_API XN_CPP_API_IMPORT
164#endif
165
166#endif //__XN_PLATFORM_H__
167
struct XnRegistrationHandleImpl * XnRegistrationHandle
Definition: XnPlatform.h:142
void(* XnFuncPtr)()
Definition: XnPlatform.h:137