15 #ifndef G3D_platform_h
16 #define G3D_platform_h
26 #if defined(__powerpc__)
27 # error PowerPC is not supported by G3D!
30 #if defined(G3D_RELEASEDEBUG)
31 # define G3D_DEBUGRELEASE
34 #if defined(G3D_DEBUGRELEASE) && defined(_DEBUG)
40 #if !defined(G3D_DEBUG) && (defined(_DEBUG) || defined(G3D_DEBUGRELEASE))
50 #define G3D_WINSOCK_MAJOR_VERSION 2
51 #define G3D_WINSOCK_MINOR_VERSION 0
65 #elif defined(__MINGW32__)
67 #undef __MSVCRT_VERSION__
68 #define __MSVCRT_VERSION__ 0x0601
70 #elif defined(__FreeBSD__) || defined(__OpenBSD__)
73 #elif defined(__linux__)
75 #elif defined(__APPLE__)
82 #error Unknown platform
92 # define __thread __declspec(thread)
96 #if (defined(_M_X64) || defined(_WIN64) || defined(__LP64__) || defined(_LP64))
107 # error G3D only supports the gcc compiler on Linux.
109 # define G3D_NO_FFMPEG
114 # error G3D only supports the gcc compiler on OS X.
117 # if defined(__i386__)
118 # define G3D_OSX_INTEL
119 # elif defined(__PPC__)
122 # define G3D_OSX_UNKNOWN
138 # pragma warning (disable : 4996)
142 # pragma warning (disable : 4127)
154 # define G3D_DEPRECATED __declspec(deprecated)
157 # ifndef _WINSOCKAPI_
158 # define _G3D_INTERNAL_HIDE_WINSOCK_
159 # define _WINSOCKAPI_
163 # pragma warning (disable : 4786)
169 # define G3D_CHECK_PRINTF_ARGS
173 # define G3D_CHECK_VPRINTF_ARGS
177 # define G3D_CHECK_PRINTF_METHOD_ARGS
181 # define G3D_CHECK_VPRINTF_METHOD_ARGS
204 #ifdef _STATIC_CPPLIB
205 #undef _STATIC_CPPLIB
211 #pragma comment(linker, "/NODEFAULTLIB:MSVCRT.LIB")
212 #pragma comment(linker, "/NODEFAULTLIB:MSVCPRT.LIB")
216 # ifndef WIN32_LEAN_AND_MEAN
217 # define WIN32_LEAN_AND_MEAN 1
223 # ifndef _WIN32_WINNT
224 # define _WIN32_WINNT 0x0500
226 # include <windows.h>
227 # undef WIN32_LEAN_AND_MEAN
230 # ifdef _G3D_INTERNAL_HIDE_WINSOCK_
231 # undef _G3D_INTERNAL_HIDE_WINSOCK_
239 # define G3D_START_AT_MAIN()\
240 int WINAPI G3D_WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw);\
241 int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) {\
242 return G3D_WinMain(hInst, hPrev, szCmdLine, sw);\
249 # define G3D_START_AT_MAIN()
257 # if __STDC_VERSION__ < 199901
258 # define restrict __restrict__
263 # define G3D_DEPRECATED __attribute__((__deprecated__))
266 # if defined(__i386__) && ! defined(__x86_64__)
269 # define __cdecl __attribute__((cdecl))
273 # define __stdcall __attribute__((stdcall))
276 # elif defined(__x86_64__)
285 # endif // calling conventions
289 # define G3D_CHECK_PRINTF_METHOD_ARGS __attribute__((__format__(__printf__, 2, 3)))
293 # define G3D_CHECK_VPRINTF_METHOD_ARGS __attribute__((__format__(__printf__, 2, 0)))
297 # define G3D_CHECK_PRINTF_ARGS __attribute__((__format__(__printf__, 1, 2)))
301 # define G3D_CHECK_VPRINTF_ARGS __attribute__((__format__(__printf__, 1, 0)))
320 # define PRAGMA(x) __pragma(x)
323 # define PRAGMA(x) _Pragma(#x)
341 # define G3D_BEGIN_PACKED_CLASS(byteAlign) class __attribute((__packed__))
342 #elif defined(_MSC_VER)
343 # define G3D_BEGIN_PACKED_CLASS(byteAlign) PRAGMA( pack(push, byteAlign) ) class
345 # define G3D_BEGIN_PACKED_CLASS(byteAlign) class
353 # define G3D_END_PACKED_CLASS(byteAlign) __attribute((aligned(byteAlign))) ;
354 #elif defined(_MSC_VER)
355 # define G3D_END_PACKED_CLASS(byteAlign) ; PRAGMA( pack(pop) )
357 # define G3D_END_PACKED_CLASS(byteAlign) ;
362 #if (defined(__GNUC__) && defined(__APPLE__)) || defined(__linux__)
365 #if (!defined(_LIBCPP_VERSION) && defined(__APPLE__)) || (!defined(_LIBCPP_VERSION) && defined(__linux__))
366 # include <tr1/memory>
372 #if (!defined(_LIBCPP_VERSION) && defined(__APPLE__)) || (!defined(_LIBCPP_VERSION) && defined(__linux__))
373 using std::tr1::shared_ptr;
374 using std::tr1::weak_ptr;
375 using std::tr1::dynamic_pointer_cast;
376 using std::tr1::static_pointer_cast;
377 using std::tr1::enable_shared_from_this;
379 using std::shared_ptr;
381 using std::dynamic_pointer_cast;
382 using std::static_pointer_cast;
383 using std::enable_shared_from_this;
410 namespace _internal {
418 #define NUMBER_TO_STRING(x) NUMBER_TO_STRING2(x)
419 #define NUMBER_TO_STRING2(x) #x
420 #define __LINE_AS_STRING__ NUMBER_TO_STRING(__LINE__)
422 #endif // Header guard
Definition: platform.h:387
#define true
Definition: CascPort.h:17
bool threadedNetworking
Should G3D spawn its own network thread?
Definition: platform.h:402
G3DSpecification()
Definition: platform.h:404
virtual ~G3DSpecification()
Definition: platform.h:406
G3DSpecification & g3dInitializationSpecification()