omw  0.2.1-beta
defs.h
Go to the documentation of this file.
1 /*
2 author Oliver Blaser
3 date 20.08.2022
4 copyright MIT - Copyright (c) 2022 Oliver Blaser
5 */
6 
14 #ifndef IG_OMW_DEFS_H
15 #define IG_OMW_DEFS_H
16 
23 
31 #ifndef OMWi_DOXYGEN_PREDEFINE
32 
33 #if defined(__clang__)
34 #define OMW_CXX_CLANG (1)
35 #elif defined(__GNUC__) || defined(__GNUG__)
36 #define OMW_CXX_GCC (1)
37 #elif defined(_MSC_VER)
38 #define OMW_CXX_MSVC (1)
39 #elif defined(__MINGW32__)
40 #define OMW_CXX_MINGW32 (1)
41 #elif defined(__MINGW64__)
42 #define OMW_CXX_MINGW64 (1)
43 #elif defined(__EMSCRIPTEN__)
44 #define OMW_CXX_EMSCRIPTEN (1)
45 #else
46 #define OMW_CXX_UNKNOWN (1)
47 #endif
48 
49 #else // OMWi_DOXYGEN_PREDEFINE
50 #define OMW_CXX_CLANG (1)
51 #define OMW_CXX_GCC (1)
52 #define OMW_CXX_MSVC (1)
53 #define OMW_CXX_MINGW32 (1)
54 #define OMW_CXX_MINGW64 (1)
55 #define OMW_CXX_EMSCRIPTEN (1)
56 #define OMW_CXX_UNKNOWN (1)
57 #endif // OMWi_DOXYGEN_PREDEFINE
58 
60 
61 
62 
71 
72 #ifndef OMWi_DOXYGEN_PREDEFINE
73 
74 #ifdef _WIN32
75 #define OMW_PLAT_WIN (1)
76 #ifdef _WIN64
77 #define OMW_PLAT_WIN64 (1)
78 #else // _WIN64
79 #define OMW_PLAT_WIN32 (1)
80 #endif // _WIN64
81 #endif // _WIN32
82 
83 #if (defined(__unix__) || defined(__unix))
84 #define OMW_PLAT_UNIX (1)
85 #include <unistd.h>
86 #ifdef _POSIX_VERSION
87 #define OMW_PLAT_POSIX (1)
88 #endif // _POSIX_VERSION
89 #endif // Unix
90 
91 #ifdef __linux__
92 #define OMW_PLAT_LINUX (1)
93 #endif // __linux__
94 
95 #if (defined(__APPLE__) && defined(__MACH__))
96 #define OMW_PLAT_APPLE (1)
97 #endif // Apple
98 
99 
100 
101 #if (defined(OMW_PLAT_UNIX) || defined(OMW_PLAT_APPLE))
102 #include <sys/param.h>
103 #ifdef BSD
104 #define OMW_PLAT_BSD (1)
105 #endif // BSD
106 #endif // Unix or Apple
107 
108 #if !(defined(OMW_PLAT_WIN) || defined(OMW_PLAT_UNIX) || defined(OMW_PLAT_LINUX) || defined(OMW_PLAT_APPLE))
109 #define OMW_PLAT_UNKNOWN (1)
110 #endif
111 
112 
113 
114 #else // OMWi_DOXYGEN_PREDEFINE
115 #define OMW_PLAT_WIN (1)
116 #define OMW_PLAT_WIN32 (1)
117 #define OMW_PLAT_WIN64 (1)
118 #define OMW_PLAT_UNIX (1)
119 #define OMW_PLAT_POSIX (1)
120 #define OMW_PLAT_LINUX (1)
121 #define OMW_PLAT_APPLE (1)
122 #define OMW_PLAT_BSD (1)
123 #define OMW_PLAT_UNKNOWN (1)
124 #endif // OMWi_DOXYGEN_PREDEFINE
125 
127 
128 
129 
137 
138 #ifndef OMWi_DOXYGEN_PREDEFINE
139 
140 #ifdef OMW_CXX_MSVC
141 
142 #if defined(_M_IX86)
143 #define OMW_PARCH_x86_32 (1)
144 #elif (defined(_M_AMD64) || defined(_M_X64))
145 #define OMW_PARCH_x86_64 (1)
146 #elif defined(_M_ARM64)
147 #define OMW_PARCH_ARM64 (1)
148 #elif defined(_M_ARM)
149 #define OMW_PARCH_ARM32 (1)
150 #else
151 #define OMW_PARCH_UNKNOWN (1)
152 #endif
153 
154 #else // OMW_CXX_MSVC
155 
156 #if defined(__i386__)
157 #define OMW_PARCH_x86_32 (1)
158 #elif defined(__x86_64__)
159 #define OMW_PARCH_x86_64 (1)
160 #elif defined(__aarch64__)
161 #define OMW_PARCH_ARM64 (1)
162 #elif defined(__arm__)
163 #define OMW_PARCH_ARM32 (1)
164 #elif defined(__powerpc64__)
165 #define OMW_PARCH_POWERPC (1)
166 #else
167 #define OMW_PARCH_UNKNOWN (1)
168 #endif
169 
170 #endif // OMW_CXX_MSVC
171 
172 
173 
174 //#ifdef OMW_PARCH_UNKNOWN
175 //#define OMW_PBITW (0u)
176 //#else // OMW_PARCH_UNKNOWN
177 //#if (defined(OMW_PARCH_x86_32) || defined(OMW_PARCH_ARM32))
178 //#define OMW_PBITW (32u)
179 //#else
180 //#define OMW_PBITW (64u)
181 //#endif
182 //#endif // OMW_PARCH_UNKNOWN
183 
184 
185 
186 #else // OMWi_DOXYGEN_PREDEFINE
187 #define OMW_PARCH_x86_32 (1)
188 #define OMW_PARCH_x86_64 (1)
189 #define OMW_PARCH_ARM32 (1)
190 #define OMW_PARCH_ARM64 (1)
191 #define OMW_PARCH_POWERPC (1)
192 #define OMW_PARCH_UNKNOWN (1)
193 //#define OMW_PBITW
194 #endif // OMWi_DOXYGEN_PREDEFINE
195 
197 
198 
199 
203 
204 #ifndef OMWi_DOXYGEN_PREDEFINE
205 
206 #ifdef OMW_CXX_MSVC
207 #define OMW_CPPSTD (_MSVC_LANG)
208 #else // _MSC_VER
209 #define OMW_CPPSTD (__cplusplus)
210 #endif // _MSC_VER
211 
212 #else // OMWi_DOXYGEN_PREDEFINE
213 #define OMW_CPPSTD
214 #endif // OMWi_DOXYGEN_PREDEFINE
215 
216 
217 
218 #define OMW_CPPSTD_98 (199711L)
219 #define OMW_CPPSTD_11 (201103L)
220 #define OMW_CPPSTD_14 (201402L)
221 #define OMW_CPPSTD_17 (201703L)
222 #define OMW_CPPSTD_20 (202002L)
223 
229 #define OMW_CPPSTD_23 (202100L)
230 
232 
233 
237 
238 #ifdef _DEBUG
239 #define OMW_DEBUG (1)
240 #endif // _DEBUG
241 
242 #if (OMW_CPPSTD >= OMW_CPPSTD_14)
243 #define OMW__FILENAME__ (OMWi_file_to_filename(__FILE__))
244 #endif
245 
246 #ifdef OMWi_DOXYGEN_PREDEFINE
247 #define OMW_DEBUG (1)
248 #define OMW__FILENAME__
249 #endif // OMWi_DOXYGEN_PREDEFINE
250 
252 
259 //##############################################################################
260 //
261 // Things below might not be of interest for users
262 //
263 //##############################################################################
264 
265 
266 
267 //==============================================================================
268 //
269 // internal
270 //
271 
272 #ifndef OMWi_DOXYGEN_PREDEFINE
273 
274 #define OMWi_DISPSTR(x) (x)
275 
276 #ifdef OMW__FILENAME__
277 constexpr const char* OMWi_file_to_filename(const char* p)
278 {
279  const char* fn = p;
280  while (*p)
281  {
282 #if defined(OMW_PLAT_WIN)
283  if (*p++ == '\\') fn = p;
284 #else
285  if (*p++ == '/') fn = p;
286 #endif
287  }
288  return fn;
289 }
290 #endif // OMW__FILENAME__
291 
292 #endif // OMWi_DOXYGEN_PREDEFINE
293 
294 
295 
296 //==============================================================================
297 //
298 // doc
299 //
300 
301 
342 #endif // IG_OMW_DEFS_H