fbxsdk/core/arch/fbxarch.h Source File

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