diff options
Diffstat (limited to 'src/3rdParty/efsw/base.hpp')
-rwxr-xr-x | src/3rdParty/efsw/base.hpp | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/src/3rdParty/efsw/base.hpp b/src/3rdParty/efsw/base.hpp new file mode 100755 index 0000000..43abc4f --- /dev/null +++ b/src/3rdParty/efsw/base.hpp | |||
@@ -0,0 +1,129 @@ | |||
1 | #ifndef EFSW_BASE | ||
2 | #define EFSW_BASE | ||
3 | |||
4 | #include <efsw/efsw.hpp> | ||
5 | #include <efsw/sophist.h> | ||
6 | |||
7 | namespace efsw { | ||
8 | |||
9 | typedef SOPHIST_int8 Int8; | ||
10 | typedef SOPHIST_uint8 Uint8; | ||
11 | typedef SOPHIST_int16 Int16; | ||
12 | typedef SOPHIST_uint16 Uint16; | ||
13 | typedef SOPHIST_int32 Int32; | ||
14 | typedef SOPHIST_uint32 Uint32; | ||
15 | typedef SOPHIST_int64 Int64; | ||
16 | typedef SOPHIST_uint64 Uint64; | ||
17 | |||
18 | #define EFSW_OS_WIN 1 | ||
19 | #define EFSW_OS_LINUX 2 | ||
20 | #define EFSW_OS_MACOSX 3 | ||
21 | #define EFSW_OS_BSD 4 | ||
22 | #define EFSW_OS_SOLARIS 5 | ||
23 | #define EFSW_OS_HAIKU 6 | ||
24 | #define EFSW_OS_ANDROID 7 | ||
25 | #define EFSW_OS_IOS 8 | ||
26 | |||
27 | #define EFSW_PLATFORM_WIN32 1 | ||
28 | #define EFSW_PLATFORM_INOTIFY 2 | ||
29 | #define EFSW_PLATFORM_KQUEUE 3 | ||
30 | #define EFSW_PLATFORM_FSEVENTS 4 | ||
31 | #define EFSW_PLATFORM_GENERIC 5 | ||
32 | |||
33 | #if defined( _WIN32 ) | ||
34 | /// Any Windows platform | ||
35 | #define EFSW_OS EFSW_OS_WIN | ||
36 | #define EFSW_PLATFORM EFSW_PLATFORM_WIN32 | ||
37 | |||
38 | #if ( defined( _MSCVER ) || defined( _MSC_VER ) ) | ||
39 | #define EFSW_COMPILER_MSVC | ||
40 | #endif | ||
41 | |||
42 | /// Force windows target version above or equal to Windows Server 2008 or Windows Vista | ||
43 | #if _WIN32_WINNT < 0x600 | ||
44 | #undef _WIN32_WINNT | ||
45 | #define _WIN32_WINNT 0x600 | ||
46 | #endif | ||
47 | #elif defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ ) || \ | ||
48 | defined( __DragonFly__ ) | ||
49 | #define EFSW_OS EFSW_OS_BSD | ||
50 | #define EFSW_PLATFORM EFSW_PLATFORM_KQUEUE | ||
51 | |||
52 | #elif defined( __APPLE_CC__ ) || defined( __APPLE__ ) | ||
53 | #include <TargetConditionals.h> | ||
54 | |||
55 | #if defined( __IPHONE__ ) || ( defined( TARGET_OS_IPHONE ) && TARGET_OS_IPHONE ) || \ | ||
56 | ( defined( TARGET_IPHONE_SIMULATOR ) && TARGET_IPHONE_SIMULATOR ) | ||
57 | #define EFSW_OS EFSW_OS_IOS | ||
58 | #define EFSW_PLATFORM EFSW_PLATFORM_KQUEUE | ||
59 | #else | ||
60 | #define EFSW_OS EFSW_OS_MACOSX | ||
61 | |||
62 | #if defined( EFSW_FSEVENTS_NOT_SUPPORTED ) | ||
63 | #define EFSW_PLATFORM EFSW_PLATFORM_KQUEUE | ||
64 | #else | ||
65 | #define EFSW_PLATFORM EFSW_PLATFORM_FSEVENTS | ||
66 | #endif | ||
67 | #endif | ||
68 | |||
69 | #elif defined( __linux__ ) | ||
70 | /// This includes Linux and Android | ||
71 | #ifndef EFSW_KQUEUE | ||
72 | #define EFSW_PLATFORM EFSW_PLATFORM_INOTIFY | ||
73 | #else | ||
74 | /// This is for testing libkqueue, sadly it doesnt work | ||
75 | #define EFSW_PLATFORM EFSW_PLATFORM_KQUEUE | ||
76 | #endif | ||
77 | |||
78 | #if defined( __ANDROID__ ) || defined( ANDROID ) | ||
79 | #define EFSW_OS EFSW_OS_ANDROID | ||
80 | #else | ||
81 | #define EFSW_OS EFSW_OS_LINUX | ||
82 | #endif | ||
83 | |||
84 | #else | ||
85 | #if defined( __SVR4 ) | ||
86 | #define EFSW_OS EFSW_OS_SOLARIS | ||
87 | #elif defined( __HAIKU__ ) || defined( __BEOS__ ) | ||
88 | #define EFSW_OS EFSW_OS_HAIKU | ||
89 | #endif | ||
90 | |||
91 | /// Everything else | ||
92 | #define EFSW_PLATFORM EFSW_PLATFORM_GENERIC | ||
93 | #endif | ||
94 | |||
95 | #if EFSW_PLATFORM != EFSW_PLATFORM_WIN32 | ||
96 | #define EFSW_PLATFORM_POSIX | ||
97 | #endif | ||
98 | |||
99 | #if 1 == SOPHIST_pointer64 | ||
100 | #define EFSW_64BIT | ||
101 | #else | ||
102 | #define EFSW_32BIT | ||
103 | #endif | ||
104 | |||
105 | #if defined( arm ) || defined( __arm__ ) | ||
106 | #define EFSW_ARM | ||
107 | #endif | ||
108 | |||
109 | #define efCOMMA , | ||
110 | |||
111 | #define efSAFE_DELETE( p ) \ | ||
112 | { \ | ||
113 | if ( p ) { \ | ||
114 | delete ( p ); \ | ||
115 | ( p ) = NULL; \ | ||
116 | } \ | ||
117 | } | ||
118 | #define efSAFE_DELETE_ARRAY( p ) \ | ||
119 | { \ | ||
120 | if ( p ) { \ | ||
121 | delete[] ( p ); \ | ||
122 | ( p ) = NULL; \ | ||
123 | } \ | ||
124 | } | ||
125 | #define efARRAY_SIZE( __array ) ( sizeof( __array ) / sizeof( __array[0] ) ) | ||
126 | |||
127 | } // namespace efsw | ||
128 | |||
129 | #endif | ||