11#pragma once
22
33#include < functional>
4-
5- #if defined(GEODE_CALL)
6- #undef GEODE_CALL
7- #endif
4+ #include " cplatform.h"
85
96namespace geode {
107 class PlatformID {
@@ -70,20 +67,13 @@ namespace std {
7067#endif
7168
7269// Windows
73- #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
70+ #ifdef GEODE_IS_WINDOWS
7471
75- #define GEODE_WINDOWS (...) __VA_ARGS__
76- #define GEODE_IS_WINDOWS
77- #define GEODE_IS_DESKTOP
78- #define GEODE_PLATFORM_NAME " Windows"
7972 #define GEODE_PLATFORM_TARGET PlatformID::Windows
80- #define GEODE_CALL __stdcall
8173 #define GEODE_HIDDEN
8274 #define GEODE_DUPABLE __forceinline
8375 #define GEODE_VIRTUAL_CONSTEXPR
8476 #define GEODE_NOINLINE __declspec (noinline)
85- #define GEODE_PLATFORM_EXTENSION " .dll"
86- #define GEODE_PLATFORM_SHORT_IDENTIFIER " win"
8777
8878 #ifdef GEODE_EXPORTING
8979 #define GEODE_DLL __declspec (dllexport)
@@ -96,89 +86,51 @@ namespace std {
9686
9787 #include " windows.hpp"
9888
99- #else
100- #define GEODE_WINDOWS (...)
101- #endif
89+ #elif defined(GEODE_IS_MACOS)
10290
103- // MacOS / iOS
104- #if defined(__APPLE__)
105- #include < TargetConditionals.h>
106-
107- #if TARGET_OS_IPHONE
108- #define GEODE_MACOS (...)
109-
110- #define GEODE_IOS (...) __VA_ARGS__
111- #define GEODE_IS_IOS
112- #define GEODE_IS_MOBILE
113- #define GEODE_PLATFORM_NAME " iOS"
114- #define GEODE_PLATFORM_TARGET PlatformID::iOS
115- #define GEODE_CALL
91+ #define GEODE_PLATFORM_TARGET PlatformID::MacOS
11692 #define GEODE_HIDDEN __attribute__ ((visibility(" hidden" )))
11793 #define GEODE_DUPABLE __attribute__ ((always_inline))
11894 #define GEODE_VIRTUAL_CONSTEXPR constexpr
11995 #define GEODE_NOINLINE __attribute__ ((noinline))
120- #define GEODE_PLATFORM_EXTENSION " .ios.dylib"
121- #define GEODE_PLATFORM_SHORT_IDENTIFIER " ios"
12296
12397 #ifdef GEODE_EXPORTING
12498 #define GEODE_DLL __attribute__ ((visibility(" default" )))
12599 #else
126- #define GEODE_DLL
100+ #define GEODE_DLL
127101 #endif
128102
129103 #define GEODE_API extern " C" __attribute__((visibility(" default" )))
130104 #define GEODE_EXPORT __attribute__ ((visibility(" default" )))
131105
132- #include " ios .hpp"
106+ #include " macos .hpp"
133107
134- #else
135- #define GEODE_IOS (...)
108+ #elif defined(GEODE_IS_IOS)
136109
137- #define GEODE_MACOS (...) __VA_ARGS__
138- #define GEODE_IS_MACOS
139- #define GEODE_IS_DESKTOP
140- #define GEODE_PLATFORM_NAME " MacOS"
141- #define GEODE_PLATFORM_TARGET PlatformID::MacOS
142- #define GEODE_CALL
110+ #define GEODE_PLATFORM_TARGET PlatformID::iOS
143111 #define GEODE_HIDDEN __attribute__ ((visibility(" hidden" )))
144112 #define GEODE_DUPABLE __attribute__ ((always_inline))
145113 #define GEODE_VIRTUAL_CONSTEXPR constexpr
146114 #define GEODE_NOINLINE __attribute__ ((noinline))
147- #define GEODE_PLATFORM_EXTENSION " .dylib"
148- #define GEODE_PLATFORM_SHORT_IDENTIFIER " mac"
149115
150116 #ifdef GEODE_EXPORTING
151- #define GEODE_DLL __attribute__ ((visibility(" default" )))
117+ #define GEODE_DLL __attribute__ ((visibility(" default" )))
152118 #else
153- #define GEODE_DLL
119+ #define GEODE_DLL
154120 #endif
155121
156122 #define GEODE_API extern " C" __attribute__((visibility(" default" )))
157123 #define GEODE_EXPORT __attribute__ ((visibility(" default" )))
158124
159- #include " macos.hpp"
160- #endif
161-
162- #else
163- #define GEODE_IOS (...)
164- #define GEODE_MACOS (...)
165-
166- #endif
125+ #include " ios.hpp"
126+
127+ #elif defined(GEODE_IS_ANDROID)
167128
168- // Android
169- #if defined(__ANDROID__)
170- #define GEODE_ANDROID (...) __VA_ARGS__
171- #define GEODE_IS_ANDROID
172- #define GEODE_IS_MOBILE
173- #define GEODE_PLATFORM_NAME " Android"
174129 #define GEODE_PLATFORM_TARGET PlatformID::Android
175- #define GEODE_CALL
176130 #define GEODE_HIDDEN __attribute__ ((visibility(" hidden" )))
177131 #define GEODE_DUPABLE __attribute__ ((always_inline))
178132 #define GEODE_VIRTUAL_CONSTEXPR constexpr
179133 #define GEODE_NOINLINE __attribute__ ((noinline))
180- #define GEODE_PLATFORM_EXTENSION " .so"
181- #define GEODE_PLATFORM_SHORT_IDENTIFIER " android"
182134
183135 #ifdef GEODE_EXPORTING
184136 #define GEODE_DLL __attribute__ ((visibility(" default" )))
@@ -189,12 +141,10 @@ namespace std {
189141 #define GEODE_API extern " C" __attribute__((visibility(" default" )))
190142 #define GEODE_EXPORT __attribute__ ((visibility(" default" )))
191143
192- #include " windows .hpp"
144+ #include " android .hpp"
193145
194146#else
195- #define GEODE_ANDROID (...)
196- #endif
197147
198- # ifndef GEODE_PLATFORM_NAME
199- # error "Unsupported PlatformID!"
148+ # error "Unsupported Platform!"
149+
200150#endif
0 commit comments