98 lines
2.6 KiB
C
98 lines
2.6 KiB
C
#ifndef PLATFORM_H
|
|
#define PLATFORM_H
|
|
|
|
#if defined(__ANDROID__)
|
|
#define WAPP_PLATFORM_ANDROID
|
|
#define WAPP_PLATFORM_POSIX
|
|
#elif defined(__FreeBSD__)
|
|
#define WAPP_PLATFORM_FREE_BSD
|
|
#define WAPP_PLATFORM_BSD
|
|
#define WAPP_PLATFORM_POSIX
|
|
#elif defined(__NetBSD__)
|
|
#define WAPP_PLATFORM_NET_BSD
|
|
#define WAPP_PLATFORM_BSD
|
|
#define WAPP_PLATFORM_POSIX
|
|
#elif defined(__OpenBSD__)
|
|
#define WAPP_PLATFORM_OPEN_BSD
|
|
#define WAPP_PLATFORM_BSD
|
|
#define WAPP_PLATFORM_POSIX
|
|
#elif defined(__DragonFly__)
|
|
#define WAPP_PLATFORM_DRAGON_FLY
|
|
#define WAPP_PLATFORM_BSD
|
|
#define WAPP_PLATFORM_POSIX
|
|
#elif defined(__bsdi__)
|
|
#define WAPP_PLATFORM_BSD
|
|
#define WAPP_PLATFORM_POSIX
|
|
#elif defined(__linux__) || defined(linux) || defined(__linux) || defined(__gnu_linux__)
|
|
#define WAPP_PLATFORM_LINUX
|
|
#define WAPP_PLATFORM_POSIX
|
|
#elif defined(__GNU__) || defined(__gnu_hurd__)
|
|
#define WAPP_PLATFORM_GNU
|
|
#define WAPP_PLATFORM_POSIX
|
|
#elif defined(__APPLE__) || defined(__MACH__)
|
|
#include <TargetConditionals.h>
|
|
#if TARGET_OS_IPHONE
|
|
#define WAPP_PLATFORM_IOS
|
|
#define WAPP_PLATFORM_APPLE
|
|
#define WAPP_PLATFORM_POSIX
|
|
#elif TARGET_OS_MAC
|
|
#define WAPP_PLATFORM_MACOS
|
|
#define WAPP_PLATFORM_APPLE
|
|
#define WAPP_PLATFORM_POSIX
|
|
#else
|
|
#error "Unrecognised Apple platform"
|
|
#endif
|
|
#elif defined(_WIN64)
|
|
#define WAPP_PLATFORM_WINDOWS64
|
|
#define WAPP_PLATFORM_WINDOWS
|
|
#elif defined(_WIN32)
|
|
#define WAPP_PLATFORM_WINDOWS32
|
|
#define WAPP_PLATFORM_WINDOWS
|
|
#elif defined(__CYGWIN__)
|
|
#define WAPP_PLATFORM_CYGWIN
|
|
#define WAPP_PLATFORM_WINDOWS
|
|
#elif defined(__unix__) || defined(__unix)
|
|
#define WAPP_PLATFORM_UNIX
|
|
#define WAPP_PLATFORM_POSIX
|
|
#else
|
|
#error "Unrecognised platform"
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
#define WAPP_PLATFORM_CPP
|
|
#if __cplusplus == 199711L
|
|
#define WAPP_PLATFORM_CPP98
|
|
#elif __cplusplus == 201103L
|
|
#define WAPP_PLATFORM_CPP11
|
|
#elif __cplusplus == 201402L
|
|
#define WAPP_PLATFORM_CPP14
|
|
#elif __cplusplus == 201703L
|
|
#define WAPP_PLATFORM_CPP17
|
|
#elif __cplusplus == 202002L
|
|
#define WAPP_PLATFORM_CPP20
|
|
#elif __cplusplus == 202302L
|
|
#define WAPP_PLATFORM_CPP23
|
|
#else
|
|
#error "Unrecognised C++ version"
|
|
#endif
|
|
#else
|
|
#define WAPP_PLATFORM_C
|
|
#if defined(__STDC_VERSION__)
|
|
#if __STDC_VERSION__ == 199901L
|
|
#define WAPP_PLATFORM_C99
|
|
#elif __STDC_VERSION__ == 201112L
|
|
#define WAPP_PLATFORM_C11
|
|
#elif __STDC_VERSION__ == 201710L
|
|
#define WAPP_PLATFORM_C17
|
|
#elif __STDC_VERSION__ == 202311L
|
|
#define WAPP_PLATFORM_C23
|
|
#else
|
|
#error "Unrecognised C version"
|
|
#endif
|
|
#else
|
|
#define WAPP_PLATFORM_C89
|
|
#endif
|
|
#endif // !__cplusplus
|
|
|
|
#endif // !PLATFORM_H
|