This commit is contained in:
Abdelrahman Said 2024-06-02 23:34:38 +01:00
parent cfc98e0137
commit 55d0c25c90

View File

@ -1,62 +1,63 @@
#ifndef PLATFORM_H #ifndef PLATFORM_H
#define PLATFORM_H #define PLATFORM_H
// clang-format off
#if defined(__ANDROID__) #if defined(__ANDROID__)
#define WAPP_PLATFORM_ANDROID #define WAPP_PLATFORM_ANDROID
#define WAPP_PLATFORM_POSIX #define WAPP_PLATFORM_POSIX
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
#define WAPP_PLATFORM_FREE_BSD #define WAPP_PLATFORM_FREE_BSD
#define WAPP_PLATFORM_BSD #define WAPP_PLATFORM_BSD
#define WAPP_PLATFORM_POSIX #define WAPP_PLATFORM_POSIX
#elif defined(__NetBSD__) #elif defined(__NetBSD__)
#define WAPP_PLATFORM_NET_BSD #define WAPP_PLATFORM_NET_BSD
#define WAPP_PLATFORM_BSD #define WAPP_PLATFORM_BSD
#define WAPP_PLATFORM_POSIX #define WAPP_PLATFORM_POSIX
#elif defined(__OpenBSD__) #elif defined(__OpenBSD__)
#define WAPP_PLATFORM_OPEN_BSD #define WAPP_PLATFORM_OPEN_BSD
#define WAPP_PLATFORM_BSD #define WAPP_PLATFORM_BSD
#define WAPP_PLATFORM_POSIX #define WAPP_PLATFORM_POSIX
#elif defined(__DragonFly__) #elif defined(__DragonFly__)
#define WAPP_PLATFORM_DRAGON_FLY #define WAPP_PLATFORM_DRAGON_FLY
#define WAPP_PLATFORM_BSD #define WAPP_PLATFORM_BSD
#define WAPP_PLATFORM_POSIX #define WAPP_PLATFORM_POSIX
#elif defined(__bsdi__) #elif defined(__bsdi__)
#define WAPP_PLATFORM_BSD #define WAPP_PLATFORM_BSD
#define WAPP_PLATFORM_POSIX #define WAPP_PLATFORM_POSIX
#elif defined(__linux__) || defined(linux) || defined(__linux) || \ #elif defined(__linux__) || defined(linux) || defined(__linux) || defined(__gnu_linux__)
defined(__gnu_linux__) #define WAPP_PLATFORM_LINUX
#define WAPP_PLATFORM_LINUX #define WAPP_PLATFORM_POSIX
#define WAPP_PLATFORM_POSIX
#elif defined(__GNU__) || defined(__gnu_hurd__) #elif defined(__GNU__) || defined(__gnu_hurd__)
#define WAPP_PLATFORM_GNU #define WAPP_PLATFORM_GNU
#define WAPP_PLATFORM_POSIX #define WAPP_PLATFORM_POSIX
#elif defined(__APPLE__) || defined(__MACH__) #elif defined(__APPLE__) || defined(__MACH__)
#include <TargetConditionals.h> #include <TargetConditionals.h>
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
#define WAPP_PLATFORM_IOS #define WAPP_PLATFORM_IOS
#define WAPP_PLATFORM_APPLE #define WAPP_PLATFORM_APPLE
#define WAPP_PLATFORM_POSIX #define WAPP_PLATFORM_POSIX
#elif TARGET_OS_MAC #elif TARGET_OS_MAC
#define WAPP_PLATFORM_MACOS #define WAPP_PLATFORM_MACOS
#define WAPP_PLATFORM_APPLE #define WAPP_PLATFORM_APPLE
#define WAPP_PLATFORM_POSIX #define WAPP_PLATFORM_POSIX
#else #else
#error "Unrecognised Apple platform" #error "Unrecognised Apple platform"
#endif #endif
#elif defined(_WIN64) #elif defined(_WIN64)
#define WAPP_PLATFORM_WINDOWS64 #define WAPP_PLATFORM_WINDOWS64
#define WAPP_PLATFORM_WINDOWS #define WAPP_PLATFORM_WINDOWS
#elif defined(_WIN32) #elif defined(_WIN32)
#define WAPP_PLATFORM_WINDOWS32 #define WAPP_PLATFORM_WINDOWS32
#define WAPP_PLATFORM_WINDOWS #define WAPP_PLATFORM_WINDOWS
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)
#define WAPP_PLATFORM_CYGWIN #define WAPP_PLATFORM_CYGWIN
#define WAPP_PLATFORM_WINDOWS #define WAPP_PLATFORM_WINDOWS
#elif defined(__unix__) || defined(__unix) #elif defined(__unix__) || defined(__unix)
#define WAPP_PLATFORM_UNIX #define WAPP_PLATFORM_UNIX
#define WAPP_PLATFORM_POSIX #define WAPP_PLATFORM_POSIX
#else #else
#error "Unrecognised platform" #error "Unrecognised platform"
#endif #endif
// clang-format on
#endif // !PLATFORM_H #endif // !PLATFORM_H