From 62fdef86019fb03d75d5b525f5ac1adf0d218ed2 Mon Sep 17 00:00:00 2001 From: Abdelrahman <said.abdelrahman89@gmail.com> Date: Sun, 2 Jun 2024 20:08:28 +0100 Subject: [PATCH] Add platform detection definitions --- src/platform/platform.h | 61 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/platform/platform.h diff --git a/src/platform/platform.h b/src/platform/platform.h new file mode 100644 index 0000000..546e7a3 --- /dev/null +++ b/src/platform/platform.h @@ -0,0 +1,61 @@ +#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__) +#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 + +#endif // !PLATFORM_H