FBX C++ API Reference
fbxarch.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
43 #ifndef _FBXSDK_CORE_ARCH_ARCH_H_
44 #define _FBXSDK_CORE_ARCH_ARCH_H_
45 
46 #if defined(_WIN32) || defined(_WIN64) //Microsoft Windows ------------------------------
47 
48  #define FBXSDK_ENV_WIN 1
49 
50  #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
51  #define FBXSDK_ENV_WINSTORE 1
52  #endif
53 
54  #if defined(_M_X64)
55  #define FBXSDK_ARCH_AMD64 1
56  #define FBXSDK_CPU_64 1
57  #elif defined(_M_IX86)
58  #define FBXSDK_ARCH_IX86 1
59  #define FBXSDK_CPU_32 1
60  #elif defined(_M_ARM)
61  #define FBXSDK_ARCH_ARM 1
62  #define FBXSDK_CPU_32 1
63  #elif defined(_M_ARM64)
64  #define FBXSDK_ARCH_ARM 1
65  #define FBXSDK_CPU_64 1
66  #else
67  #error Unsupported architecture!
68  #endif
69 
70  #if defined(_MSC_VER)
71  #define FBXSDK_COMPILER_MSC 1
72  #elif defined(__GNUC__)
73  #define FBXSDK_COMPILER_GNU 1
74  #elif defined(__ICL)
75  #define FBXSDK_COMPILER_INTEL 1
76  #else
77  #error Unsupported compiler!
78  #endif
79 
80 #elif defined(__APPLE__) || defined(__MACH__) //Apple MacOS/X ---------------------------
81 
82  #include "TargetConditionals.h"
83 
84  #define FBXSDK_ENV_MAC 1
85 
86  #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
87  #define FBXSDK_ENV_IOS 1
88  #endif
89 
90  #if defined(__i386__)
91  #define FBXSDK_ARCH_IX86 1
92  #define FBXSDK_CPU_32 1
93  #elif defined(__x86_64__) || defined(__x86_64)
94  #define FBXSDK_ARCH_AMD64 1
95  #define FBXSDK_CPU_64 1
96  #elif defined(__arm__)
97  #define FBXSDK_ARCH_ARM 1
98  #define FBXSDK_CPU_32 1
99  #elif defined(__arm64__)
100  #define FBXSDK_ARCH_ARM 1
101  #define FBXSDK_CPU_64 1
102  #else
103  #error Unsupported architecture!
104  #endif
105 
106  #if defined(__GNUC__)
107  #define FBXSDK_COMPILER_GNU 1
108  #endif
109 
110  #if defined(__clang__)
111  #define FBXSDK_COMPILER_CLANG 1
112  #endif
113 
114  #if !defined(FBXSDK_COMPILER_GNU) && !defined(FBXSDK_COMPILER_CLANG)
115  #error Unsupported compiler!
116  #endif
117 
118 #elif defined(__linux__) || defined(__CYGWIN__) || defined(EMSCRIPTEN) || defined(ANDROID) //Linux ---------------------------------
119 
120  #define FBXSDK_ENV_LINUX 1
121 
122  #if defined(EMSCRIPTEN)
123  #define FBXSDK_ENV_EMSCRIPTEN 1
124  #endif
125 
126  #if defined(ANDROID)
127  #define FBXSDK_ENV_ANDROID 1
128  #endif
129 
130  #if defined(__i386__)
131  #define FBXSDK_ARCH_IX86 1
132  #define FBXSDK_CPU_32 1
133  #elif defined(__x86_64__) || defined(__x86_64)
134  #define FBXSDK_ARCH_AMD64 1
135  #define FBXSDK_CPU_64 1
136  #elif defined(__arm__)
137  #define FBXSDK_ARCH_ARM 1
138  #define FBXSDK_CPU_32 1
139  #elif defined(EMSCRIPTEN)
140  #define FBXSDK_ARCH_AMD64 1
141  #define FBXSDK_CPU_64 1
142  #else
143  #error Unsupported architecture!
144  #endif
145 
146  #if defined(__GNUC__)
147  #define FBXSDK_COMPILER_GNU 1
148  #elif defined(EMSCRIPTEN)
149  #define FBXSDK_COMPILER_EMSCRIPTEN 1
150  #else
151  #error Unsupported compiler!
152  #endif
153  #else
154  #error Unsupported platform!
155 #endif
156 
157 //---------------------------------------------------------------------------------------
158 //Compiler Specifics
159 #if defined(FBXSDK_SHARED)
160  #if defined(FBXSDK_COMPILER_MSC) || defined(FBXSDK_COMPILER_INTEL)
161  #define FBXSDK_DLLIMPORT __declspec(dllimport)
162  #define FBXSDK_DLLEXPORT __declspec(dllexport)
163  #elif defined(FBXSDK_COMPILER_GNU) && (__GNUC__ >= 4)
164  #define FBXSDK_DLLIMPORT __attribute__((visibility("default")))
165  #define FBXSDK_DLLEXPORT __attribute__((visibility("default")))
166  #else
167  #define FBXSDK_DLLIMPORT
168  #define FBXSDK_DLLEXPORT
169  #endif
170 #else
171  #define FBXSDK_DLLIMPORT
172  #define FBXSDK_DLLEXPORT
173 #endif
174 
175 #ifndef FBXSDK_DLL
176  #define FBXSDK_DLL FBXSDK_DLLIMPORT
177 #endif
178 
179 #if defined(FBXSDK_COMPILER_MSC)
180  #pragma warning(disable : 4251) //'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
181  #if _MSC_VER >= 1300 // 7.1
182  #define FBX_DEPRECATED __declspec(deprecated)
183  #else
184  #define FBX_DEPRECATED
185  #endif
186 #elif defined(FBXSDK_COMPILER_GNU) || defined(FBXSDK_COMPILER_EMSCRIPTEN)
187  #define FBX_DEPRECATED __attribute__((deprecated))
188 #elif defined(FBXSDK_COMPILER_INTEL)
189  #if __INTEL_COMPILER >= 810
190  #define FBX_DEPRECATED __declspec(deprecated)
191  #else
192  #define FBX_DEPRECATED
193  #endif
194 #else
195  #error Unsupported compiler!
196 #endif
197 
198 #ifdef FBXSDK_COMPILER_CLANG
199  #define FBX_UNUSED(p) _Pragma(FBX_STRINGIFY(unused(p)))
200 #else
201  #define FBX_UNUSED(p) (void)(p)
202 #endif
203 
204 //---------------------------------------------------------------------------------------
205 //Platform Standardization
206 #ifndef NULL
207  #if defined(__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
208  #define NULL (__null)
209  #else
210  #if defined(__cplusplus)
211  #define NULL 0
212  #else
213  #define NULL ((void*)0)
214  #endif
215  #endif
216 #endif
217 
218 #if !defined(_MAX_PATH)
219  #define _MAX_PATH 260
220 #endif
221 
222 #if !defined(FBXSDK_COMPILER_MSC)
223  #ifndef strcmpi
224  #define strcmpi strcasecmp
225  #endif
226  #ifndef stricmp
227  #define stricmp strcasecmp
228  #endif
229  #ifndef strncmpi
230  #define strncmpi strncasecmp
231  #endif
232  #ifndef strnicmp
233  #define strnicmp strncasecmp
234  #endif
235 #endif
236 
237 #endif /* _FBXSDK_CORE_ARCH_ARCH_H_ */