-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathplatform.h
62 lines (57 loc) · 1.44 KB
/
platform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef LIBIM_PLATFORM_H
#define LIBIM_PLATFORM_H
#include <cstdint>
#ifdef __APPLE__
# include "TargetConditionals.h"
#elif defined(WIN32) || defined(_WIN32)
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
# undef NOMINMAX
#endif
#if !defined(_WIN32) || defined(__MINGW32__)
# include <sys/stat.h>
#endif
#if INTPTR_MAX == INT64_MAX
# define LIBIM_PLATFORM_64BIT 1
#elif INTPTR_MAX == INT32_MAX
# define LIBIM_PLATFORM_32BIT
#else
# error Unknown pointer size or missing size macros!
#endif
namespace libim {
enum class PlatformOS
{
Windows,
macOS,
iOS,
Linux,
Android,
UnknownOS
};
#ifdef __APPLE__
# ifdef TARGET_OS_MAC
# define LIBIM_OS_MACOS 1
inline constexpr auto platformOS = PlatformOS::macOS;
# else
# define LIBIM_OS_IOS 1
inline constexpr auto platformOS = PlatformOS::iOS;
# endif
#elif defined(_WIN32) || defined(__MINGW32__)
# define LIBIM_OS_WINDOWS 1
inline constexpr auto platformOS = PlatformOS::Windows;
#elif defined(__linux__)
# ifdef __ANDROID__
# define LIBIM_OS_ANDROID 1
inline constexpr auto platformOS = PlatformOS::Android;
# else
# define LIBIM_OS_LINUX 1
inline constexpr auto platformOS = PlatformOS::Linux;
# endif
#else
# warning "Unknown platform operating system!"
inline constexpr auto platformOS = PlatformOS::UnknownOS;
#endif
}
#endif //LIBIM_PLATFORM_H